From c5dd41d530d99c693f5386a5471848d4be42e524 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 24 Jul 2024 14:38:46 +0100 Subject: [PATCH] tenmp handling the case where we have iwi and ewi in the bills models --- backend/Property.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/backend/Property.py b/backend/Property.py index 956dd586..580dbb89 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -350,7 +350,19 @@ class Property: r for r in property_representative_recommendations if r["phase"] <= phase ] - epc_transformations = [x["description_simulation"] for x in represenative_recs_to_this_phase] + # TODO: This is placeholder, but it's to handle the case of having both internal and external wall + # insulation as options. This will cause the process below to fall over, so we take just + # external wall insulation in epc_transformations, if we have both + types = [ + x["type"] for x in represenative_recs_to_this_phase + ] + if "external_wall_insulation" in types and "internal_wall_insulation" in types: + epc_transformations = [ + x["description_simulation"] for x in represenative_recs_to_this_phase if + x["type"] != "internal_wall_insulation" + ] + else: + epc_transformations = [x["description_simulation"] for x in represenative_recs_to_this_phase] # It is possible that we could have two simulations applied to the same descriptions # We extract these out