major test refactoring

This commit is contained in:
Ross
2025-06-05 23:40:28 +01:00
parent b9ca76aea1
commit a647416720
13 changed files with 1690 additions and 2282 deletions
+5 -4
View File
@@ -392,6 +392,7 @@ class RotaBuilder(object):
debug_if_fail: bool = False,
):
console.print("Setting up solver")
console.print(f"{options=}")
if solver == "scip":
if "seconds" in options:
@@ -516,6 +517,9 @@ class RotaBuilder(object):
self.build_workers()
self.build_model()
console.print("Building model")
console.print(f"{options=}")
if solve:
self.solve_model(
options=options, debug_if_fail=debug_if_fail, solver=solver
@@ -2203,7 +2207,6 @@ class RotaBuilder(object):
self.get_week_start_date(week)
):
# Force shifts to be assigned in blocks
try:
self.model.constraints.add(
self.model.shift_week_worker_assigned[
shift.name, week, worker.id
@@ -2214,8 +2217,6 @@ class RotaBuilder(object):
for day in shift.days
)
)
except KeyError:
pass # blocks with workerd requirements
#
@@ -3213,7 +3214,7 @@ class RotaBuilder(object):
shifts = []
for shift in self.shifts:
if shift.start_date < date <= shift.end_date:
if shift.start_date <= date < shift.end_date:
if shift.get_worker_requirement_by_date(date):
shifts.append(shift)