feat: add exact shifts display in worker details and update HTML export functionality

This commit is contained in:
Ross
2026-07-08 22:38:38 +01:00
parent 0f31dfe1a9
commit 13c5ae598a
4 changed files with 66 additions and 5 deletions
+37 -1
View File
@@ -1832,4 +1832,40 @@ def test_exact_shifts_exceed_total_warning():
warnings = Rota.get_warnings("Exact shifts exceed total shifts")
assert len(warnings) > 0
assert "total exact shifts (4) exceeds total required shifts" in warnings[0][1]
assert "total exact shifts (4) exceeds total required shifts" in warnings[0][1]
def test_html_export_worker_details_and_unavailable_reason():
weeks_to_rota = 2
start_date = datetime.date(2022, 3, 7)
Rota = RotaBuilder(
start_date,
weeks_to_rota=weeks_to_rota,
)
Rota.add_workers([
Worker(
name="worker1",
site="group1",
grade=1,
fte=100,
exact_shifts={"a": 1},
start_date=datetime.date(2022, 3, 14)
),
])
Rota.add_shifts(
SingleShift(
sites=("group1",),
name="a",
length=12.5,
days=("Mon",),
workers_required=1,
),
)
Rota.build_workers()
Rota.build_model()
html = Rota.get_worker_timetable_html()
assert 'data-exact-shifts=\'{"a": 1}\'' in html
assert 'title=\' (2022-03-07) / START DATE: 2022-03-14\'' in html