This commit is contained in:
Ross
2021-01-17 23:20:09 +00:00
parent 68738a2cfe
commit 3a543ef5b4
5 changed files with 114 additions and 13 deletions
+7 -8
View File
@@ -48,15 +48,14 @@ class Worker:
if self.end_date > Rota.rota_end_date:
self.end_date = Rota.rota_end_date
else:
days_to_work = (self.end_date - Rota.start_date).days
if self.end_date > Rota.start_date:
days_to_work = (self.end_date - Rota.start_date).days
if days_to_work < 0:
days_to_work = 0
# add unavalabilities
for weeks_days in Rota.weeks_days_product[days_to_work:]:
week, day = weeks_days
Rota.unavailable_to_work.add((self.id, week, day))
# add unavalabilities
for weeks_days in Rota.weeks_days_product[days_to_work:]:
week, day = weeks_days
Rota.unavailable_to_work.add((self.id, week, day))
if oop is not None:
start_oop, end_oop = oop
@@ -67,7 +66,7 @@ class Worker:
# ignore oops if they finish before the rota start date
if end_oop_date < Rota.start_date:
if end_oop_date > Rota.start_date:
if end_oop_date > Rota.rota_end_date:
end_oop_date = Rota.rota_end_date