mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Map door custom_displayable_fields to DoorVentilation 🟩
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
06816c3f9c
commit
1dd3baeac5
1 changed files with 18 additions and 1 deletions
|
|
@ -102,4 +102,21 @@ def _map_window_ventilation(
|
|||
|
||||
|
||||
def _map_door(wi: api.WallItem) -> Door:
|
||||
return Door(width_mm=round(wi.size.x, 2))
|
||||
return Door(
|
||||
width_mm=round(wi.size.x, 2),
|
||||
ventilation=_map_door_ventilation(wi.custom_displayable_fields),
|
||||
)
|
||||
|
||||
|
||||
def _map_door_ventilation(
|
||||
fields: list[api.SurveyField],
|
||||
) -> Optional[DoorVentilation]:
|
||||
if not fields:
|
||||
return None
|
||||
by_label = {f.label: f for f in fields}
|
||||
f = by_label.get("Door Undercut (mm)")
|
||||
if f is None or not f.value.has_value:
|
||||
return None
|
||||
raw = f.value.value
|
||||
undercut = float(raw[0] if isinstance(raw, list) else raw)
|
||||
return DoorVentilation(undercut_mm=undercut)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue