From 1c5ccb2c8c46a613851dfaf153a16ee4242eaf0a Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 12 Apr 2024 15:26:11 +0100 Subject: [PATCH] added override to roof insulation --- recommendations/RoofRecommendations.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recommendations/RoofRecommendations.py b/recommendations/RoofRecommendations.py index 8d6a91e7..ed087228 100644 --- a/recommendations/RoofRecommendations.py +++ b/recommendations/RoofRecommendations.py @@ -5,7 +5,7 @@ from typing import List from datatypes.enums import QuantityUnits from recommendations.recommendation_utils import ( get_roof_u_value, r_value_per_mm_to_u_value, calculate_u_value_uplift, is_diminishing_returns, - update_lowest_selected_u_value, get_recommended_part, convert_thickness_to_numeric + update_lowest_selected_u_value, get_recommended_part, convert_thickness_to_numeric, override_costs ) from recommendations.Costs import Costs @@ -207,12 +207,18 @@ class RoofRecommendations: floor_area=self.property.insulation_floor_area, material=material ) + is_override = "loft_insulation" in cost_result + if is_override: + cost_result = override_costs(cost_result) elif material["type"] == "flat_roof_insulation": cost_result = self.costs.flat_roof_insulation( floor_area=self.property.insulation_floor_area, material=material, non_insulation_materials=non_insulation_materials ) + is_override = "flat_roof_insulation" in cost_result + if is_override: + cost_result = override_costs(cost_result) else: raise ValueError("Invalid material type") @@ -232,6 +238,7 @@ class RoofRecommendations: "starting_u_value": u_value, "new_u_value": new_u_value, "sap_points": None, + "is_override": is_override, **cost_result } )