From 116cc1af646032fdff75682e85f4a16773c30b3b Mon Sep 17 00:00:00 2001 From: Ross Date: Mon, 8 Dec 2025 22:45:10 +0000 Subject: [PATCH] . --- .gitignore | 2 +- output/tests/timetable.css | 2 +- output/tests/timetable.js | 2 +- rota/shifts.py | 7 ++++--- test/test_nights2.py | 3 ++- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 7325ecf..fb94c45 100644 --- a/.gitignore +++ b/.gitignore @@ -14,4 +14,4 @@ logs/ *.db web/rota -cons/ \ No newline at end of file +cons/ diff --git a/output/tests/timetable.css b/output/tests/timetable.css index 6694d8b..8a82cf4 120000 --- a/output/tests/timetable.css +++ b/output/tests/timetable.css @@ -1 +1 @@ -/home/ross/proc_rota/output/timetable.css \ No newline at end of file +/home/ross/proc-rota/output/timetable.css \ No newline at end of file diff --git a/output/tests/timetable.js b/output/tests/timetable.js index b7adfdf..7cdb8bf 120000 --- a/output/tests/timetable.js +++ b/output/tests/timetable.js @@ -1 +1 @@ -/home/ross/proc_rota/output/timetable.js \ No newline at end of file +/home/ross/proc-rota/output/timetable.js \ No newline at end of file diff --git a/rota/shifts.py b/rota/shifts.py index 37373a3..da2ac18 100644 --- a/rota/shifts.py +++ b/rota/shifts.py @@ -92,13 +92,13 @@ class NightConstraint(BaseShiftConstraint): class PreShiftConstraint(BaseShiftConstraint): days: Any = None ignore_shifts: List[str] = [] - exclude_days: List[str] = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] + exclude_days: List[str] = [] allow_self: bool = True class PostShiftConstraint(BaseShiftConstraint): days: Any = None ignore_shifts: List[str] = [] - exclude_days: List[str] = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] + exclude_days: List[str] = [] allow_self: bool = True class BalanceAcrossGroupsConstraint(BaseShiftConstraint): @@ -389,7 +389,8 @@ class RotaBuilder(object): "max_night_frequency_week_exclusions": [], "max_shifts_per_week": 7, "max_shifts_per_month": 40, - "max_days_per_week_block": [(3, 2)], # (max_days, week_block) + "max_days_per_week_block": [], + #"max_days_per_week_block": [(3, 2)], # (max_days, week_block) # The following will cause an unsolvable problem if a shift # is forced as a block and spans the time peroid "prevent_monday_after_full_weekends": [], diff --git a/test/test_nights2.py b/test/test_nights2.py index b09df06..458e7e3 100644 --- a/test/test_nights2.py +++ b/test/test_nights2.py @@ -108,7 +108,7 @@ def test_nights_fail(): length=12.5, days=days[5:], force_as_block=True, - constraints=[NightConstraint(), PreShiftConstraint(days=3)], + constraints=[NightConstraint(), PreShiftConstraint(days=8), PostShiftConstraint(days=2)], workers_required=2, ), SingleShift( @@ -120,6 +120,7 @@ def test_nights_fail(): ), ) Rota.build_and_solve(options={"ratio": 0.000}) + Rota.export_rota_to_html("night fail", folder="tests") assert Rota.results.solver.status in ("warning", "error") def test_nights2():