-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Describe your changes big one: removed vehicles and its ties to shifts, that will be handled separately via a flag in `shift_request` table. added `shift_position` which acts as a replacement for vehicles and essentially creates position slots for each shift of which volunteers can be assigned to, not very resource efficient I'm aware but it seemed the most object oriented way of doing it. work flow cant be thought of as: 1) "scheduler-user" creates a `shift_request` entry `shift_request` entry contains key information about the shift etc but specifically the `vehicle_id` flag which ... 2) triggers a function that adds the specific assignment and amount of `roles` required for the shift to the `shift_position` table linked back to the shift. The amount of positions and their roles types depends on the `vehicle_id` flag. (note this is not implemented in this pr but will be created soon [FIR-112](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-112) ) 3) Then, the scheduler (`optimiser`) is called and it obtains all the info from the relevant tables: `shift_request, shift_position, roles` and extrapolates data into values that mini zinc can use. 4) mini zinc returns a 2d array of best volunteers for each shift as well as persisting them to the database table `shift_request_volunteer`. ( [FIR-111](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-111) ) Other misc changes included: - Adding unavailability parameter to `user` table. - Changing the link to roles be through role.code instead of Id as it makes more canonical sense. BIG RISK as it might mess with mini zinc , `user_roles` and how we parse the roles types however it can simply be reworked. added unique flag to the code to ensure only one of each role type is ever created. - Commenting out the deprecated code of the original calculator. Ideally I should have set this up in a separate file (I still can, id just have to copy all local changes into a new branch in a separate file) I just happened to do it in the file as it was easiest to see which stuff impacted which directly. more details of the table linking logic at commit b099dac note theres is a conflict in this pr in the domain/entity/__init__.py just of notification stuff will be handled when prompted by GitHub. ## Issue ticket number and link [FIR-4](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-4) [FIR-51](https://fireapp-emergiq-2024.atlassian.net/browse/FIR-51) note: its a tiny bit of a mess as I wasn't signed in and it wouldn't let me pr but I didn't realise so I went through a whole mess of rebasing origin/main into my branch before realising
- Loading branch information
Showing
6 changed files
with
93 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from datetime import datetime | ||
|
||
from sqlalchemy import Column, String, DateTime, ForeignKey, Integer, Enum | ||
from sqlalchemy.orm import relationship | ||
|
||
from domain.base import Base | ||
|
||
|
||
class ShiftPosition(Base): | ||
__tablename__ = 'shift_position' | ||
|
||
id = Column(Integer, primary_key=True, autoincrement=True) | ||
shift_id = Column(Integer, ForeignKey('shift_request.id'), nullable=False) | ||
role_code = Column(String(256), ForeignKey('role.code'), nullable=False) | ||
|
||
# Many-to-one relationship with Role | ||
role = relationship("Role") | ||
|
||
# One-to-one relationship with ShiftRequestVolunteer using backref | ||
volunteer = relationship("ShiftRequestVolunteer", uselist=False, backref="shift_position", | ||
primaryjoin="ShiftPosition.id == ShiftRequestVolunteer.position_id") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters