Enhance leave request handling and improve error logging in RotaBuilder
This commit is contained in:
+15
-9
@@ -69,8 +69,12 @@ def extract_leave_and_rota_from_calender(calender_df):
|
||||
"date": date,
|
||||
"worker": worker,
|
||||
})
|
||||
else:
|
||||
logger.warning(f"Unknown leave value for {worker} on {date}: {leave_val}")
|
||||
elif leave_val != "" and leave_val != "nan":
|
||||
leave_requests.append({
|
||||
"date": date,
|
||||
"worker": worker,
|
||||
})
|
||||
|
||||
|
||||
#print(leave_requests)
|
||||
return leave_requests, work_requests, rota_data
|
||||
@@ -242,12 +246,12 @@ def load_workers():
|
||||
nwds=non_working_days,
|
||||
)
|
||||
|
||||
if initial == "L1":
|
||||
w.oop = [OutOfProgramme(
|
||||
start_date="2025-09-15",
|
||||
end_date="2025-10-14",
|
||||
reason="even out shifts",
|
||||
)]
|
||||
#if initial == "L1":
|
||||
# w.oop = [OutOfProgramme(
|
||||
# start_date="2025-09-15",
|
||||
# end_date="2025-10-14",
|
||||
# reason="even out shifts",
|
||||
# )]
|
||||
|
||||
if initial == "ND":
|
||||
print(w.not_available_to_work)
|
||||
@@ -331,6 +335,8 @@ def main(
|
||||
Rota.constraint_options["max_days_worked_per_week"] = 3
|
||||
# Rota.constraint_options["avoid_st2_first_month"] = True
|
||||
|
||||
#Rota.enable_unavailabilities = False
|
||||
|
||||
Rota.add_shifts(
|
||||
SingleShift(
|
||||
sites=("rota a",),
|
||||
@@ -368,7 +374,7 @@ def main(
|
||||
workers_required=1,
|
||||
length=12.5,
|
||||
days=days[5:],
|
||||
balance_offset=1,
|
||||
balance_offset=2,
|
||||
#constraint=[
|
||||
# {"name": "pre", "options": 1},
|
||||
# {"name": "post", "options": 1},
|
||||
|
||||
Reference in New Issue
Block a user