fixed day time testing

This commit is contained in:
2026-07-23 15:39:14 -04:00
parent f2d2a6c2e7
commit e76c76a4df
6 changed files with 211 additions and 55 deletions
+5 -2
View File
@@ -39,9 +39,11 @@ def get_shift_capacity_for_date(
current_date: date,
holiday_dates: set[str],
daytime_shift2_only: bool = False,
daytime_shift2_minutes: int = 480,
) -> dict[int, int]:
if daytime_shift2_only:
return {1: 0, 2: 480, 3: 0}
daytime_minutes = max(0, min(int(daytime_shift2_minutes), 480))
return {1: 0, 2: daytime_minutes, 3: 0}
if is_off_day(current_date, holiday_dates):
return {1: 480, 2: 480, 3: 480}
return {1: 480, 2: 0, 3: 480}
@@ -51,10 +53,11 @@ def get_shift_sequence_with_capacity(
current_date: date,
holiday_dates: set[str],
daytime_shift2_only: bool = False,
daytime_shift2_minutes: int = 480,
) -> tuple[list[tuple[date, int]], int]:
shifts = get_shift_sequence(current_date, holiday_dates, daytime_shift2_only)
capacity = sum(
get_shift_capacity_for_date(day, holiday_dates, daytime_shift2_only).get(shift_index, 0)
get_shift_capacity_for_date(day, holiday_dates, daytime_shift2_only, daytime_shift2_minutes).get(shift_index, 0)
for day, shift_index in shifts
)
return shifts, capacity