From 3eaf2011b0dd9daaf663f82ae72eb5930d0de388 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Fri, 15 May 2026 15:44:46 +0000 Subject: [PATCH] =?UTF-8?q?Wire=20=5Fapply=5Fsection=5Fborders=20into=20he?= =?UTF-8?q?aders=20and=20data=20rows;=20consolidate=20constants=20?= =?UTF-8?q?=F0=9F=9F=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/magic_plan/audit_script.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/backend/magic_plan/audit_script.py b/backend/magic_plan/audit_script.py index 4908684d..2eccdb27 100644 --- a/backend/magic_plan/audit_script.py +++ b/backend/magic_plan/audit_script.py @@ -15,6 +15,9 @@ _HEADER_FILL = PatternFill("solid", fgColor="D9D9D9") _FLOOR_FILL = PatternFill("solid", fgColor="BDD7EE") _BOLD = Font(bold=True) _TOTAL_COLS = 25 # A–Y +_BLANK_SEPARATOR_COLS = {5, 21} +_MEDIUM_RIGHT = Border(right=Side(style="medium")) +_SECTION_BOUNDARY_COLS = {4, 11, 15, 20} @dataclass @@ -82,13 +85,6 @@ def _build_rows(plan: Plan) -> list[AuditRow]: return rows -_BLANK_SEPARATOR_COLS = {5, 21} - - -_MEDIUM_RIGHT = Border(right=Side(style="medium")) -_SECTION_BOUNDARY_COLS = {4, 11, 15, 20} - - def _apply_section_borders(ws: Worksheet, row: int) -> None: for col in _SECTION_BOUNDARY_COLS: ws.cell(row=row, column=col).border = _MEDIUM_RIGHT @@ -134,6 +130,7 @@ def _write_headers(ws: Worksheet) -> None: for col in range(1, _TOTAL_COLS + 1): if col not in _BLANK_SEPARATOR_COLS: ws.cell(row=row, column=col).fill = _HEADER_FILL + _apply_section_borders(ws, row) def _write_data_rows(ws: Worksheet, rows: list[AuditRow]) -> None: @@ -162,6 +159,7 @@ def _write_data_rows(ws: Worksheet, rows: list[AuditRow]) -> None: ws.cell(row=xl_row, column=11, value=row.window_opening_type) ws.cell(row=xl_row, column=22, value=row.door_location) ws.cell(row=xl_row, column=23, value=row.door_width_mm) + _apply_section_borders(ws, xl_row) xl_row += 1