AuditRow carries opening and trickle_vent fields, all None on every row 🟩

This commit is contained in:
Daniel Roth 2026-05-15 15:35:04 +00:00
parent f010a360c5
commit 70035e6e14

View file

@ -9,7 +9,7 @@ from datatypes.magicplan.domain.models import Plan
from backend.app.db.connection import db_read_session from backend.app.db.connection import db_read_session
from backend.app.db.functions.magic_plan_functions import get_plan_by_uploaded_file_id from backend.app.db.functions.magic_plan_functions import get_plan_by_uploaded_file_id
UPLOADED_FILE_ID: int = 123 UPLOADED_FILE_ID: int = 7843
_HEADER_FILL = PatternFill("solid", fgColor="D9D9D9") _HEADER_FILL = PatternFill("solid", fgColor="D9D9D9")
_FLOOR_FILL = PatternFill("solid", fgColor="BDD7EE") _FLOOR_FILL = PatternFill("solid", fgColor="BDD7EE")
@ -32,6 +32,15 @@ class AuditRow:
window_opening_type: Optional[str] = None window_opening_type: Optional[str] = None
door_location: Optional[str] = None door_location: Optional[str] = None
door_width_mm: Optional[float] = None door_width_mm: Optional[float] = None
opening_count: Optional[int] = None
opening_width_m: Optional[float] = None
opening_height_m: Optional[float] = None
opening_total_area_m2: Optional[float] = None
trickle_vent_blocked: Optional[bool] = None
trickle_vent_pictured: Optional[bool] = None
trickle_vent_effective_area: Optional[float] = None
trickle_vent_count: Optional[int] = None
trickle_vent_total_effective_area: Optional[float] = None
def _build_rows(plan: Plan) -> list[AuditRow]: def _build_rows(plan: Plan) -> list[AuditRow]:
@ -128,8 +137,10 @@ def _write_data_rows(ws: Worksheet, rows: list[AuditRow]) -> None:
cell.font = _BOLD cell.font = _BOLD
cell.fill = _FLOOR_FILL cell.fill = _FLOOR_FILL
ws.merge_cells( ws.merge_cells(
start_row=xl_row, start_column=1, start_row=xl_row,
end_row=xl_row, end_column=_TOTAL_COLS, start_column=1,
end_row=xl_row,
end_column=_TOTAL_COLS,
) )
else: else:
ws.cell(row=xl_row, column=1, value=row.room_name) ws.cell(row=xl_row, column=1, value=row.room_name)
@ -177,7 +188,7 @@ def main() -> None:
_write_headers(ws) _write_headers(ws)
_write_data_rows(ws, rows) _write_data_rows(ws, rows)
output_path = f"/tmp/magic_plan_audit_{UPLOADED_FILE_ID}.xlsx" output_path = f"./magic_plan_audit_{UPLOADED_FILE_ID}.xlsx"
wb.save(output_path) wb.save(output_path)
print(output_path) print(output_path)