This project is based on the Gruppeneinteilungssystem auge from the Goethe University Frankfurt. It's goal is to provide a simple web application for the allocation of lockers to students in a fair and efficient manner.
To start the development server, run the following command in the project directory:
npm run devOpen http://localhost:3000 with your browser to see the result.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
The tests need to run successfully before a pull request can be merged! If you want to contribute to this project, please make sure to add tests for your changes. To run the tests, use:
npm testTo run the linter, use:
npm run lintThe algorithm for assigning the lockers is implemented in app/admin/api/assign/route.ts. A brief overview of the algorithm is as follows:
Let fobidden in lib/lockerData.json) and
- If
$|S| > n$ then randomly select a subset of size$n$ from$S$ and replace$S$ with this subset. - Shuffle
$S$ randomly. - Create four subsets of
$S$ :-
$S_{LR}$ : Students that wish to get a locker in a specific locker cabinet and on a specific row. -
$S_{L}$ : Students that wish to get a locker in a specific locker cabinat but have no preference for a specific row. -
$S_{R}$ : Students that wish to get a locker on a specific row but have no preference for a specific locker cabinet. -
$S_{N}$ : Students that have no preference for a specific locker cabinet or row.
-
- For each student in
$S_{LR}$ in the order of$S_{LR}$ :- If there is at least one locker available in the specified locker cabinet and row:
- Shuffle the available lockers in the specified locker cabinet and row randomly.
- Assign the first locker in the shuffled list to the student and mark it as assigned.
- Else:
- Remove the row preference of the student and move them to
$S_{L}$ .
- Remove the row preference of the student and move them to
- Continue with the next student in
$S_{LR}$ .
- If there is at least one locker available in the specified locker cabinet and row:
- For each student in
$S_{L}$ in the order of$S_{L}$ :- If there is at least one locker available in the specified cabinet:
- Shuffle the available lockers in the specified locker cabinet randomly.
- Assign the first locker in the shuffled list to the student and mark it as assigned.
- Else:
- Remove the locker cabinet preference of the student and move them to
$S_{N}$ .
- Remove the locker cabinet preference of the student and move them to
- Continue with the next student in
$S_{L}$ .
- If there is at least one locker available in the specified cabinet:
- For each student in
$S_{R}$ in the order of$S_{R}$ :- If there is at least one locker available on the specified row:
- Shuffle the available lockers on the specified row randomly.
- Assign the first locker in the shuffled list to the student and mark it as assigned.
- Else:
- Remove the row preference of the student and move them to
$S_{N}$ .
- Remove the row preference of the student and move them to
- Continue with the next student in
$S_{R}$ .
- If there is at least one locker available on the specified row:
- For each student in
$S_{N}$ in the order of$S_{N}$ :- If there is at least one locker available:
- Shuffle the available lockers randomly.
- Assign the first locker in the shuffled list to the student and mark it as assigned.
- Continue with the next student in
$S_{N}$ .
- If there is at least one locker available:
- End.