This commit is contained in:
Ross
2025-01-25 08:49:14 +00:00
parent 8459a4b3a9
commit 242a664f49
8 changed files with 535 additions and 110 deletions
+8 -1
View File
@@ -67,6 +67,9 @@ class NonWorkingDays(BaseModel):
class WorkRequests(BaseModel):
"""
Shift is the name of the shift requested, * is a wildcard for any shift
"""
date: datetime.date
shift: str = ""
@@ -99,6 +102,9 @@ class Worker(BaseModel):
pref_not_to_work: list[PreferenceNotToWork] = []
work_requests: list[WorkRequests] = []
locum_availability: list[WorkRequests] = []
locum_max_shifts: int = 0
locum_max_shifts_per_week: int = 0
locum_on_nwds: bool = False
remote_site: str = "plymouth" # We set a default proc_site
previous_shifts: dict = {}
shift_balance_extra: dict = {}
@@ -293,7 +299,8 @@ class Worker(BaseModel):
week = days_from_start // 7 + 1
day = Rota.days[(days_from_start % 7)]
if request.shift == "*":
for shift in Rota.get_shifts_for_worker_site(self.site):
# We may want to add a limit to shifts that can be filled by locums?
for shift in Rota.get_shifts():
Rota.locum_availability.add((self.id, week, day, shift.name))
else:
Rota.locum_availability.add((self.id, week, day, request.shift))