mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
_build_rows produces correct row groups, window labels, and location fields 🟩
This commit is contained in:
parent
b6320b745e
commit
e6878a821f
1 changed files with 36 additions and 1 deletions
|
|
@ -22,4 +22,39 @@ class AuditRow:
|
|||
|
||||
|
||||
def _build_rows(plan: Plan) -> list[AuditRow]:
|
||||
raise NotImplementedError
|
||||
rows: list[AuditRow] = []
|
||||
window_counter = 1
|
||||
|
||||
for floor in plan.floors:
|
||||
rows.append(AuditRow(floor_level=floor.level))
|
||||
|
||||
for room in floor.rooms:
|
||||
n_rows = max(1, len(room.windows), len(room.doors))
|
||||
|
||||
for i in range(n_rows):
|
||||
window = room.windows[i] if i < len(room.windows) else None
|
||||
door = room.doors[i] if i < len(room.doors) else None
|
||||
|
||||
row = AuditRow(
|
||||
room_name=room.name if i == 0 else None,
|
||||
room_width_m=room.width_m if i == 0 else None,
|
||||
room_length_m=room.length_m if i == 0 else None,
|
||||
room_area_m2=room.area_m2 if i == 0 else None,
|
||||
)
|
||||
|
||||
if window is not None:
|
||||
row.window_label = f"W{window_counter}"
|
||||
row.window_location = room.name
|
||||
row.window_width_m = window.width_m
|
||||
row.window_height_m = window.height_m
|
||||
row.window_area_m2 = window.area_m2
|
||||
row.window_opening_type = window.opening_type
|
||||
window_counter += 1
|
||||
|
||||
if door is not None:
|
||||
row.door_location = room.name
|
||||
row.door_width_mm = door.width_mm
|
||||
|
||||
rows.append(row)
|
||||
|
||||
return rows
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue