major test refactoring
This commit is contained in:
+5
-4
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user