Fix weekend shift initial extraction and update worker start/end dates for leave requests
This commit is contained in:
+5
-3
@@ -115,6 +115,8 @@ def extract_shift_assignments_from_rota(rota_df):
|
|||||||
if col_idx >= len(row):
|
if col_idx >= len(row):
|
||||||
continue
|
continue
|
||||||
initial = str(row.iloc[col_idx]).strip()
|
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 initial and initial.lower() != "nan" and initial.lower() != "nat":
|
||||||
if weekend:
|
if weekend:
|
||||||
shift = "weekend"
|
shift = "weekend"
|
||||||
@@ -209,13 +211,13 @@ def load_workers():
|
|||||||
if initial == "ND":
|
if initial == "ND":
|
||||||
start_date = "2025-09-29" # Non-working day worker starts later
|
start_date = "2025-09-29" # Non-working day worker starts later
|
||||||
if initial == "MF":
|
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":
|
if initial == "AA":
|
||||||
start_date = "2025-11-17" # Absent worker starts later
|
start_date = "2025-11-17" # Absent worker starts later
|
||||||
|
|
||||||
end_date = None
|
end_date = None
|
||||||
if initial == "L1":
|
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":
|
elif initial == "L2":
|
||||||
end_date = "2025-09-29" # L2 worker has a leave request
|
end_date = "2025-09-29" # L2 worker has a leave request
|
||||||
|
|
||||||
@@ -393,7 +395,7 @@ def main(
|
|||||||
days=days[:5],
|
days=days[:5],
|
||||||
balance_offset=1,
|
balance_offset=1,
|
||||||
constraints=[
|
constraints=[
|
||||||
#{"name": "pre", "options": 1},
|
PreShiftConstraint(days=1, start_date="2025-11-17", ignore_shifts=["oncall"]),
|
||||||
#{"name": "post", "options": 1},
|
#{"name": "post", "options": 1},
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user