Wire _apply_section_borders into headers and data rows; consolidate constants 🟪

This commit is contained in:
Daniel Roth 2026-05-15 15:44:46 +00:00
parent 2801756e56
commit 3eaf2011b0

View file

@ -15,6 +15,9 @@ _HEADER_FILL = PatternFill("solid", fgColor="D9D9D9")
_FLOOR_FILL = PatternFill("solid", fgColor="BDD7EE")
_BOLD = Font(bold=True)
_TOTAL_COLS = 25 # AY
_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