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