Skip to content
forked from fntneves/lei

♻️ Maximize shift exchanges between pools of student requests

Notifications You must be signed in to change notification settings

cesium/swap-solver

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

97 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Package CI Docker

♻️ Maximize shift exchanges between pools of student requests

This is a service used to calculate the maximum possible shift exchanges in the Swap platform.

📥 Prerequisites

The following software is required to be installed on your system:

The Maven Wrapper is an easy way to ensure a user of your Maven build has everything necessary to run your Maven build. The wrapper should work on various operating systems including:

  • Linux (numerous versions, tested on Ubuntu and CentOS) [bin/mvnw]
  • OSX / macOS [bin/mvnw]
  • Windows (various newer versions) [bin/mvnw.cmd]
  • Solaris (10 and 11) [bin/mvnw]

🔧 Setup

Clone the repository.

git clone https://github.com/cesium/swap-solver
cd swap-solver

Open the project in your favourite IDE. This is a Maven project. If your IDE does not support building Maven projects by default, please refer to the official guides.

🔨 Development

Start the server on http://localhost:4567.

mvn compile exec:java

Run the project tests.

mvn test

Format the code accordingly to common guide lines.

mvn spotless:apply

Lint your code with checkstyle.

mvn checkstyle:check

🐳 Running inside docker

Build the docker images.

docker build -t swap-solver .

Run the image.

docker run -d -p 4567:4567 swap-solver mvn exec:java

⌨️ Making requests

The service is hosted by default on http://localhost:4567. The accepted request is a POST method and its body should follow this structure:

{
  "exchange_requests": [
    {
      "id": "a1",
      "from_shift_id": "TP1",
      "to_shift_id": "TP5",
      "created_at": 1
    },
    {
      "id": "a2",
      "from_shift_id": "TP5",
      "to_shift_id": "TP1",
      "created_at": 1
    },
    {
      "id": "a3",
      "from_shift_id": "TP2",
      "to_shift_id": "TP4",
      "created_at": 2
    }
  ]
}

The return is a JSON as the following:

{
  "solved_exchanges": ["a1", "a2"]
}

About

♻️ Maximize shift exchanges between pools of student requests

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 99.7%
  • Dockerfile 0.3%