fix(orion): correct report numbering toc and first page
This commit is contained in:
parent
503b343070
commit
47f54d3461
7 changed files with 283 additions and 137 deletions
|
|
@ -26,6 +26,7 @@ from app.modules.orion.components import (
|
|||
)
|
||||
from app.modules.orion.context import OrionContextBuilder, ReportContext
|
||||
from app.modules.orion.templates.report import render_document
|
||||
from app.modules.orion.template_service import REPORT_SECTIONS
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -52,51 +53,35 @@ class OrionReportService:
|
|||
return output_path
|
||||
|
||||
def _components(self) -> list[ReportComponent]:
|
||||
chapters: list[ReportComponent] = [
|
||||
StaticTextComponent("bq", "1 Funktionsqualifikation (BQ)", "nicht erfasst"),
|
||||
StaticTextComponent("bq-goal", "1.1 Anlass und Ziel der Prüfung", block_key="bq_goal"),
|
||||
StaticTextComponent("legal", "1.2 Gesetzliche Grundlagen", block_key="legal"),
|
||||
DeviceComponent(),
|
||||
StaticTextComponent("performance", "1.4 Leistungsüberprüfung", block_key="performance"),
|
||||
ChecklistComponent(),
|
||||
StaticTextComponent("documentation", "1.6 Dokumentation / Kontrolle"),
|
||||
StaticTextComponent("work-instructions", "1.7 Arbeitsanweisungen"),
|
||||
EnvironmentComponent(),
|
||||
StaticTextComponent("batch-control", "1.9 Chargenkontrolle"),
|
||||
ProgramComponent(),
|
||||
LoadingComponent(),
|
||||
StaticTextComponent("reference-load", "1.12 Referenzbeladung Sterilisator"),
|
||||
StaticTextComponent("equipment", "2 Eingesetzte Prüfmittel"),
|
||||
EquipmentComponent(),
|
||||
StaticTextComponent("equipment-thermo", "2.2 Prüfmittel zur thermoelektrischen Untersuchung"),
|
||||
StaticTextComponent("configuration", "2.3 Prüfkonfiguration"),
|
||||
StaticTextComponent("lq", "3 Leistungsqualifikation (LQ)"),
|
||||
StaticTextComponent("thermo-tests", "3.1 Leistungsbeurteilung – Thermoelektrische Prüfungen"),
|
||||
MeasurementComponent(),
|
||||
StaticTextComponent("run-1", "3.2 Standardbeladung – Testlauf 1"),
|
||||
StaticTextComponent("test-1", "3.2.1 Test 1"),
|
||||
StaticTextComponent("run-2", "3.3 Standardbeladung – Testlauf 2"),
|
||||
StaticTextComponent("test-2", "3.3.1 Test 2"),
|
||||
StaticTextComponent("run-3", "3.4 Standardbeladung – Testlauf 3"),
|
||||
StaticTextComponent("test-3", "3.4.1 Test 3"),
|
||||
StaticTextComponent("results", "4 Ergebnisse der Validierung"),
|
||||
StaticTextComponent("results-vacuum", "4.1 Vakuumtest"),
|
||||
StaticTextComponent("results-runs", "4.1.2 Testläufe 1 bis 3"),
|
||||
DryingComponent(),
|
||||
RecommendationComponent(),
|
||||
StaticTextComponent("appendix", "5 Anhang"),
|
||||
AttachmentComponent(),
|
||||
StaticTextComponent("winlog", "5.1 Winlog-Auswertungen"),
|
||||
StaticTextComponent("release-docs", "5.2 Freigabedokumentation / Routineprüfungen"),
|
||||
StaticTextComponent("indicators", "5.3 Nachweis der umgeschlagenen Indikatoren"),
|
||||
StaticTextComponent("cycles", "6 Programmabläufe / Zyklen"),
|
||||
StaticTextComponent("practice-certificates", "6.1 Zertifikate Praxis"),
|
||||
StaticTextComponent("risk", "7 Risikoeinstufung nach RKI"),
|
||||
StaticTextComponent("closing-talk", "7.1 Abschlussgespräch"),
|
||||
StaticTextComponent("certificates", "8. Zertifikate"),
|
||||
StaticTextComponent("calibration-certificates", "9. Werkskalibrierzertifikate Sensoren"),
|
||||
]
|
||||
return [CoverComponent(), SummaryComponent(), TocComponent(chapters), CustomerComponent(), *chapters]
|
||||
chapters = [self._component_for_section(item) for item in REPORT_SECTIONS]
|
||||
return [CoverComponent(), SummaryComponent(), TocComponent(REPORT_SECTIONS), CustomerComponent(), *chapters]
|
||||
|
||||
def _component_for_section(self, item: dict) -> ReportComponent:
|
||||
component = item.get("component")
|
||||
key = str(item["key"])
|
||||
title = str(item["title"])
|
||||
number = item.get("number")
|
||||
if component == "device":
|
||||
return DeviceComponent(key, title, number)
|
||||
if component == "checklist":
|
||||
return ChecklistComponent(key, title, number)
|
||||
if component == "environment":
|
||||
return EnvironmentComponent(key, title, number)
|
||||
if component == "programs":
|
||||
return ProgramComponent(key, title, number)
|
||||
if component == "loading":
|
||||
return LoadingComponent(key, title, number)
|
||||
if component == "equipment":
|
||||
return EquipmentComponent(key, title, number)
|
||||
if component == "measurements":
|
||||
return MeasurementComponent(key, title, number)
|
||||
if component == "drying":
|
||||
return DryingComponent(key, title, number)
|
||||
if component == "recommendations":
|
||||
return RecommendationComponent(key, title, number)
|
||||
if component == "attachments":
|
||||
return AttachmentComponent(key, title, number)
|
||||
return StaticTextComponent(key, title, block_key=item.get("block_key"), number=number)
|
||||
|
||||
def _append_pdf_attachments(self, context: ReportContext, output_path: Path) -> None:
|
||||
pdf_paths = []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue