From a8d772abfc0733024222a4e8b23f85349ce344c4 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 28 Jan 2026 18:44:03 +0000 Subject: [PATCH] minor handling for when a user switches off ventilation as an option --- backend/engine/engine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/engine/engine.py b/backend/engine/engine.py index 67353b7a..e833eb89 100644 --- a/backend/engine/engine.py +++ b/backend/engine/engine.py @@ -1051,11 +1051,14 @@ async def model_engine(body: PlanTriggerRequest): property_required_measures = [m for m in recommendations[p.id] if m[0]["type"] in body.required_measures] measures_to_optimise = [m for m in recommendations[p.id] if m[0]["type"] not in body.required_measures] + ventilation_included = "ventilation" in property_measure_types + # If a measure requiring ventilation is selected, and the property does not have ventilation, we enfore # its inclusion + needs_ventilation = any( x in property_measure_types for x in assumptions.measures_needing_ventilation - ) and not p.has_ventilation + ) and not p.has_ventilation and ventilation_included if not measures_to_optimise: # Nothing to do, we just reshape the recommendations