Fix weekend shift initial extraction and update worker start/end dates for leave requests

This commit is contained in:
Ross
2025-09-18 20:14:23 +01:00
parent 331d57dd8f
commit fdce572f6d
+5 -3
View File
@@ -115,6 +115,8 @@ def extract_shift_assignments_from_rota(rota_df):
if col_idx >= len(row):
continue
initial = str(row.iloc[col_idx]).strip()
if weekend:
initial = initial.split("/")[0].strip() # In case of "initial1/initial2", take the first one
if initial and initial.lower() != "nan" and initial.lower() != "nat":
if weekend:
shift = "weekend"
@@ -209,13 +211,13 @@ def load_workers():
if initial == "ND":
start_date = "2025-09-29" # Non-working day worker starts later
if initial == "MF":
start_date = "2025-10-06" # Medical leave worker starts earlier
start_date = "2026-01-15" # Medical leave worker starts earlier
if initial == "AA":
start_date = "2025-11-17" # Absent worker starts later
end_date = None
if initial == "L1":
end_date = "2025-11-06" # L1 worker has a leave request
end_date = "2025-11-17" # L1 worker has a leave request
elif initial == "L2":
end_date = "2025-09-29" # L2 worker has a leave request
@@ -393,7 +395,7 @@ def main(
days=days[:5],
balance_offset=1,
constraints=[
#{"name": "pre", "options": 1},
PreShiftConstraint(days=1, start_date="2025-11-17", ignore_shifts=["oncall"]),
#{"name": "post", "options": 1},
],
),