From 71eae0600d674584835d53b23dcf93d0274cc632 Mon Sep 17 00:00:00 2001 From: Martin Tazl Date: Tue, 20 Oct 2026 16:15:19 +0200 Subject: [PATCH] Remove redundant shift speed section --- docs/shift-report.md | 5 +++-- src/production_analytics/presentation/shift_report.py | 11 ----------- tests/test_shift_report.py | 2 +- tests/test_shift_report_html.py | 2 ++ tests/test_shift_report_pdf.py | 7 +++---- tests/test_shift_report_web.py | 2 +- 6 files changed, 10 insertions(+), 19 deletions(-) diff --git a/docs/shift-report.md b/docs/shift-report.md index c5099b9..a7990da 100644 --- a/docs/shift-report.md +++ b/docs/shift-report.md @@ -277,8 +277,9 @@ Speed always uses the approximate FA windows. The shift report's production table uses these same FA windows and KPI results for each listed order. Its speed describes the FA's estimated period; material -uses the configured segment or order-aware source rule. The shift-wide speed and -material sections remain useful reconciliation totals. In HTML, the FA number +uses the configured segment or order-aware source rule. The shift-wide material +section remains available as a reconciliation total; the shift-wide speed +summary stays in the report model but is not rendered. In HTML, the FA number links directly to `/order?production_order=...` for the order's full shift list. The PDF prints the FA number as text. diff --git a/src/production_analytics/presentation/shift_report.py b/src/production_analytics/presentation/shift_report.py index 6ecd51f..eadb5a0 100644 --- a/src/production_analytics/presentation/shift_report.py +++ b/src/production_analytics/presentation/shift_report.py @@ -201,17 +201,6 @@ def present_report( story.append( MaterialPieBlock(labels, tuple(quantity for _, _, quantity in positive_materials)) ) - text("Liniengeschwindigkeit", "Heading2") - if report.speed is None: - text("Für diese Maschine nicht verfügbar.") - else: - speed = report.speed.average_line_speed_m_min - text( - "Durchschnittliche Liniengeschwindigkeit im Lauf: " - + (f"{_number(speed)} m/min" if speed is not None - else "Nicht verfügbar (keine Laufdaten).") - ) - return tuple(story) diff --git a/tests/test_shift_report.py b/tests/test_shift_report.py index 9fa417c..b1027c9 100644 --- a/tests/test_shift_report.py +++ b/tests/test_shift_report.py @@ -260,7 +260,7 @@ def test_partial_capabilities_skip_disabled_sources_and_render_unavailable( blocks = present_report(report) unavailable = [b for b in blocks if isinstance(b, TextBlock) and b.text == "Für diese Maschine nicht verfügbar."] - assert len(unavailable) == (2 if downtime else 3) + assert len(unavailable) == (1 if downtime else 2) def test_downtime_only_machine_does_not_query_production(): diff --git a/tests/test_shift_report_html.py b/tests/test_shift_report_html.py index ec50e82..01d8ff5 100644 --- a/tests/test_shift_report_html.py +++ b/tests/test_shift_report_html.py @@ -44,6 +44,8 @@ def test_production_rows_show_attributed_kpis_and_link_fa_to_detail(): assert '10,24 m/min' in html assert '3.317,58 kg' in html assert 'Details' not in html + assert "Durchschnittliche Liniengeschwindigkeit im Lauf" not in html + assert "

Liniengeschwindigkeit

" not in html def test_production_kpis_distinguish_unavailable_from_zero(): diff --git a/tests/test_shift_report_pdf.py b/tests/test_shift_report_pdf.py index 022ca28..dec25ce 100644 --- a/tests/test_shift_report_pdf.py +++ b/tests/test_shift_report_pdf.py @@ -48,15 +48,14 @@ def test_stable_model_required_labels_and_supplied_quantities(): "Zeit ohne erfassten Stillstand", "Materialverbrauch", "42,00 kg", - "Liniengeschwindigkeit im Lauf", "order", "article", "description", ): assert label in text assert "Produktionszeit" not in text - value = replace(value, speed=replace(value.speed, average_line_speed_m_min=12.345)) - assert "12,35 m/min" in content(value) + assert "Liniengeschwindigkeit im Lauf" not in text + assert "Durchschnittliche Liniengeschwindigkeit" not in text def test_production_pdf_table_contains_attributed_kpis_as_plain_text(): @@ -72,6 +71,7 @@ def test_production_pdf_table_contains_attributed_kpis_as_plain_text(): assert table.rows[1][-2:] == ("—", "0,00 kg") assert table.rows[0][0] == "12026001032" assert "Materialverbrauch gesamt: 42,00 kg" in content(value) + assert "Liniengeschwindigkeit im Lauf" not in content(value) assert render_pdf(value).startswith(b"%PDF-") @@ -110,7 +110,6 @@ def test_empty_sections_and_zero_totals(): "Keine Stillstandsgründe vorhanden.", "Keine Stillstandsereignisse vorhanden.", "Keine Materialverbrauchsdaten vorhanden.", - "keine Laufdaten", "Gesamtmenge: 0,00 m²", "Rollen gesamt: 0", ): diff --git a/tests/test_shift_report_web.py b/tests/test_shift_report_web.py index cc5c744..801b632 100644 --- a/tests/test_shift_report_web.py +++ b/tests/test_shift_report_web.py @@ -111,12 +111,12 @@ def test_default_and_render(application): "42,00 kg", "description", "Ohne Stillstandsgrund", - "Nicht verfügbar", "Datenstand: 14.10.2026 15:46:00 CEST", "Europe/Berlin", "Als PDF exportieren", ): assert expected in text + assert "Durchschnittliche Liniengeschwindigkeit im Lauf" not in text assert headers["Cache-Control"] == "no-store"