style(orion): align report header footer and page layout
This commit is contained in:
parent
302e542fda
commit
503b343070
40 changed files with 2010 additions and 148 deletions
|
|
@ -11,8 +11,16 @@ from app.models.contact import Contact
|
|||
from app.models.customer import Customer
|
||||
from app.models.device import Device
|
||||
from app.models.equipment import Equipment
|
||||
from app.models.report_template import (
|
||||
ChecklistTemplate,
|
||||
MeasurementImport,
|
||||
MeasurementImportValue,
|
||||
ReportSection,
|
||||
TextBlock,
|
||||
)
|
||||
from app.models.location import Location
|
||||
from app.models.validation import Validation
|
||||
from app.modules.orion.template_service import ReportTemplateService
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
|
|
@ -24,6 +32,10 @@ class ReportContext:
|
|||
device: Device | None
|
||||
equipment: list[Equipment]
|
||||
generated_dir: Path
|
||||
report_sections: list[ReportSection]
|
||||
text_blocks: dict[str, TextBlock]
|
||||
checklist_templates: list[ChecklistTemplate]
|
||||
confirmed_measurements: list[MeasurementImportValue]
|
||||
|
||||
|
||||
class OrionContextBuilder:
|
||||
|
|
@ -50,6 +62,17 @@ class OrionContextBuilder:
|
|||
select(Equipment).where(Equipment.id.in_(validation.equipment_ids))
|
||||
)
|
||||
)
|
||||
template_bundle = ReportTemplateService(self.session).ensure_default_template()
|
||||
confirmed_measurements = list(
|
||||
self.session.scalars(
|
||||
select(MeasurementImportValue)
|
||||
.join_from(MeasurementImportValue, MeasurementImport)
|
||||
.where(
|
||||
MeasurementImport.validation_id == validation.id,
|
||||
MeasurementImportValue.confirmed.is_(True),
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self.generated_dir.mkdir(parents=True, exist_ok=True)
|
||||
return ReportContext(
|
||||
|
|
@ -60,5 +83,8 @@ class OrionContextBuilder:
|
|||
device=device,
|
||||
equipment=equipment,
|
||||
generated_dir=self.generated_dir,
|
||||
report_sections=template_bundle.sections,
|
||||
text_blocks=template_bundle.text_blocks,
|
||||
checklist_templates=template_bundle.checklists,
|
||||
confirmed_measurements=confirmed_measurements,
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue