diff --git a/validation-suite/backend/mercury/app/modules/orion/__pycache__/result.cpython-313.pyc b/validation-suite/backend/mercury/app/modules/orion/__pycache__/result.cpython-313.pyc index 9ce7b6fb..bb070804 100644 Binary files a/validation-suite/backend/mercury/app/modules/orion/__pycache__/result.cpython-313.pyc and b/validation-suite/backend/mercury/app/modules/orion/__pycache__/result.cpython-313.pyc differ diff --git a/validation-suite/backend/mercury/app/modules/orion/components/__pycache__/chapters.cpython-313.pyc b/validation-suite/backend/mercury/app/modules/orion/components/__pycache__/chapters.cpython-313.pyc index 2304cbe0..79bd7695 100644 Binary files a/validation-suite/backend/mercury/app/modules/orion/components/__pycache__/chapters.cpython-313.pyc and b/validation-suite/backend/mercury/app/modules/orion/components/__pycache__/chapters.cpython-313.pyc differ diff --git a/validation-suite/backend/mercury/app/modules/orion/components/chapters.py b/validation-suite/backend/mercury/app/modules/orion/components/chapters.py index 09ab5193..f1f44e79 100644 --- a/validation-suite/backend/mercury/app/modules/orion/components/chapters.py +++ b/validation-suite/backend/mercury/app/modules/orion/components/chapters.py @@ -8,7 +8,7 @@ from app.modules.orion.assets import schubamed_logo_uri from app.modules.orion.components.base import ReportComponent from app.modules.orion.context import ReportContext from app.modules.orion.html import definition_list, paragraph, section, table, text, yes_no -from app.modules.orion.result import validation_result_box, validation_result_label +from app.modules.orion.result import validation_result_box, validation_result_cover_sentence, validation_result_label def render_template_text(content: str, context: ReportContext) -> str: @@ -84,7 +84,10 @@ class CoverComponent(ReportComponent): f'

{text(context.customer.name)}

' f"{rows}" '
' - f"{validation_result_box(validation.result)}" + '
' + "

Ergebnis der Validierung

" + f"

{text(validation_result_cover_sentence(validation.result))}

" + "
" '
Unterschrift technische Validierung
' "
" "" diff --git a/validation-suite/backend/mercury/app/modules/orion/result.py b/validation-suite/backend/mercury/app/modules/orion/result.py index 13d38b4c..5c378104 100644 --- a/validation-suite/backend/mercury/app/modules/orion/result.py +++ b/validation-suite/backend/mercury/app/modules/orion/result.py @@ -55,6 +55,17 @@ def validation_result_label(value: str | None) -> str: return validation_result_presentation(value).label +def validation_result_cover_sentence(value: str | None) -> str: + presentation = validation_result_presentation(value) + sentences = { + "BESTANDEN": "Die technische Validierung wurde erfolgreich bestanden.", + "BESTANDEN_MIT_AUFLAGEN": "Die technische Validierung wurde mit Auflagen bestanden.", + "NICHT_BESTANDEN": "Die technische Validierung wurde nicht bestanden.", + "OFFEN": "Die technische Validierung wurde noch nicht bewertet.", + } + return sentences[presentation.key] + + def validation_result_box(value: str | None, *, compact: bool = False) -> str: presentation = validation_result_presentation(value) size_class = "result-box--compact" if compact else "result-box--cover" diff --git a/validation-suite/backend/mercury/app/modules/orion/templates/report.css b/validation-suite/backend/mercury/app/modules/orion/templates/report.css index 8fdb8c57..1b1ed883 100644 --- a/validation-suite/backend/mercury/app/modules/orion/templates/report.css +++ b/validation-suite/backend/mercury/app/modules/orion/templates/report.css @@ -204,6 +204,31 @@ h1 { page-break-inside: avoid; } +.cover-result-text { + border-top: .25mm solid #DCE3E3; + break-inside: avoid; + margin: 2mm 0 0 0; + page-break-inside: avoid; + padding-top: 2.2mm; +} + +.cover-result-text h2 { + border: 0; + color: #4F6A74; + font-size: 10pt; + letter-spacing: .04em; + margin: 0 0 1mm 0; + padding: 0; + text-transform: uppercase; +} + +.cover-result-text p { + color: #2E3B40; + font-size: 10.5pt; + font-weight: 700; + margin: 0; +} + .result-box { border: .65mm solid #8A9498; border-radius: 1.5mm; diff --git a/validation-suite/backend/mercury/tests/__pycache__/test_validation_workflow.cpython-313-pytest-8.3.4.pyc b/validation-suite/backend/mercury/tests/__pycache__/test_validation_workflow.cpython-313-pytest-8.3.4.pyc index b594b2cd..92f952e7 100644 Binary files a/validation-suite/backend/mercury/tests/__pycache__/test_validation_workflow.cpython-313-pytest-8.3.4.pyc and b/validation-suite/backend/mercury/tests/__pycache__/test_validation_workflow.cpython-313-pytest-8.3.4.pyc differ diff --git a/validation-suite/backend/mercury/tests/test_validation_workflow.py b/validation-suite/backend/mercury/tests/test_validation_workflow.py index af818421..05cf5cd7 100644 --- a/validation-suite/backend/mercury/tests/test_validation_workflow.py +++ b/validation-suite/backend/mercury/tests/test_validation_workflow.py @@ -917,23 +917,52 @@ def test_orion_result_boxes_render_on_cover_summary_and_results(tmp_path): html = OrionReportService(db, tmp_path).render_html(validation.id) - assert html.count("VALIDIERUNGSERGEBNIS") >= 3 - assert "BESTANDEN MIT AUFLAGEN" in html + assert html.count("VALIDIERUNGSERGEBNIS") >= 2 + assert 'class="result-box result-box--cover' not in html + assert html.count('class="result-box result-box--compact') >= 2 + assert "Ergebnis der Validierung" in html + assert "Die technische Validierung wurde mit Auflagen bestanden." in html + assert "BESTANDEN MIT AUFLAGEN" not in html assert "Bestanden mit Auflagen" in html assert 'class="cover-closing"' in html + assert 'class="cover-result-text"' in html assert 'class="signature-block"' in html assert "Unterschrift technische Validierung" in html assert "Unterschrift Auftraggeber" not in html - assert html.index('id="cover"') < html.index("BESTANDEN MIT AUFLAGEN") assert html.index('id="summary"') < html.index("Bestanden mit Auflagen") assert html.index('id="results"') < html.rindex("Bestanden mit Auflagen") +def test_orion_cover_result_text_for_supported_statuses(tmp_path): + expected = { + "BESTANDEN": "Die technische Validierung wurde erfolgreich bestanden.", + "BESTANDEN_MIT_AUFLAGEN": "Die technische Validierung wurde mit Auflagen bestanden.", + "NICHT_BESTANDEN": "Die technische Validierung wurde nicht bestanden.", + } + + for value, sentence in expected.items(): + db = session() + customer, location, device = seed(db) + validation = valid_validation(customer, location, device) + validation.report_number = f"VAL-{value}" + validation.result = value + db.add(validation) + db.flush() + + html = OrionReportService(db, tmp_path / value).render_html(validation.id) + + assert "Ergebnis der Validierung" in html + assert sentence in html + assert 'class="result-box result-box--cover' not in html + assert html.count('class="result-box result-box--compact') >= 2 + + def test_orion_result_box_css_prevents_page_breaks(): css = Path("app/modules/orion/templates/report.css").read_text(encoding="utf-8") assert ".result-box" in css assert ".cover-closing" in css + assert ".cover-result-text" in css assert ".signature-block" in css assert "break-inside: avoid" in css assert "page-break-inside: avoid" in css @@ -1116,8 +1145,8 @@ def test_orion_pdf_first_page_is_cover_not_blank(tmp_path): assert "PRÜFBERICHTZURVALIDIERUNG" in normalized_text assert "FUNKTIONS-UNDLEISTUNGSQUALIFIKATION" in normalized_text - assert "VALIDIERUNGSERGEBNIS" in normalized_text - assert "BESTANDEN" in normalized_text + assert "ERGEBNISDERVALIDIERUNG" in normalized_text + assert "DIETECHNISCHEVALIDIERUNGWURDEERFOLGREICHBESTANDEN" in normalized_text def test_orion_bookmark_labels_are_created_from_central_sections(tmp_path):