Map door custom_displayable_fields to DoorVentilation 🟩

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-06-05 12:52:36 +00:00
parent 06816c3f9c
commit 1dd3baeac5

View file

@ -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)