From 8976f5563640004214b1ed65b4408fed68e87b39 Mon Sep 17 00:00:00 2001 From: Daniel Roth Date: Wed, 10 Jun 2026 13:32:11 +0000 Subject: [PATCH] add todo comment for named ranges --- domain/magicplan/ventilation_audit.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/domain/magicplan/ventilation_audit.py b/domain/magicplan/ventilation_audit.py index 74586909..74fc66e1 100644 --- a/domain/magicplan/ventilation_audit.py +++ b/domain/magicplan/ventilation_audit.py @@ -16,20 +16,34 @@ _DOOR_AREA_CF_RANGE = f"{_DOOR_AREA_COL}{_DATA_START_ROW}:{_DOOR_AREA_COL}{_DATA _Y_THRESHOLD = 7600 _DOOR_AREA_HEADER = CellRichText( TextBlock(InlineFont(b=True, sz=11, rFont="Aptos Narrow"), "Area (mm2)\n"), - TextBlock(InlineFont(b=True, sz=11, color=Color(rgb="FF0000"), rFont="Aptos Narrow"), "<"), + TextBlock( + InlineFont(b=True, sz=11, color=Color(rgb="FF0000"), rFont="Aptos Narrow"), "<" + ), TextBlock(InlineFont(b=True, sz=11, rFont="Aptos Narrow"), " 7600 "), - TextBlock(InlineFont(b=True, sz=11, color=Color(rgb="196B24"), rFont="Aptos Narrow"), "<"), + TextBlock( + InlineFont(b=True, sz=11, color=Color(rgb="196B24"), rFont="Aptos Narrow"), "<" + ), ) +# TODO: update the template and this module to use Named Ranges rather than relying on column IDs + def _apply_column_y_formatting(sheet: Any) -> None: sheet.conditional_formatting.add( _DOOR_AREA_CF_RANGE, - CellIsRule(operator="lessThan", formula=[str(_Y_THRESHOLD)], font=Font(color=Color(rgb="FF0000"))), + CellIsRule( + operator="lessThan", + formula=[str(_Y_THRESHOLD)], + font=Font(color=Color(rgb="FF0000")), + ), ) sheet.conditional_formatting.add( _DOOR_AREA_CF_RANGE, - CellIsRule(operator="greaterThan", formula=[str(_Y_THRESHOLD)], font=Font(color=Color(rgb="196B24"))), + CellIsRule( + operator="greaterThan", + formula=[str(_Y_THRESHOLD)], + font=Font(color=Color(rgb="196B24")), + ), ) sheet[f"{_DOOR_AREA_COL}3"] = _DOOR_AREA_HEADER @@ -50,7 +64,9 @@ def populate_sheet(sheet: Any, plan: Plan) -> None: if len(rooms) > _MAX_ROWS: raise ValueError(f"Room series exceeds {_MAX_ROWS} rows ({len(rooms)} rooms)") if len(windows) > _MAX_ROWS: - raise ValueError(f"Window series exceeds {_MAX_ROWS} rows ({len(windows)} windows)") + raise ValueError( + f"Window series exceeds {_MAX_ROWS} rows ({len(windows)} windows)" + ) if len(doors) > _MAX_ROWS: raise ValueError(f"Door series exceeds {_MAX_ROWS} rows ({len(doors)} doors)")