diff --git a/recommendations/WindowsRecommendations.py b/recommendations/WindowsRecommendations.py index bac20af4..917a1667 100644 --- a/recommendations/WindowsRecommendations.py +++ b/recommendations/WindowsRecommendations.py @@ -78,15 +78,17 @@ class WindowsRecommendations: self.property.data["windows-energy-eff"] in ["Poor", "Very Poor"] ) - windows_area = self.property.windows_area + # We check if the windows are partially insulated but we're recommending double glazing as a complete + # replacement + double_glazing_replacement = ( + not is_secondary_glazing and + # As defined in coverage_map in windows attributes + self.property.windows["glazing_coverage"] in ["partial", "most"] + ) if not number_of_windows: raise ValueError("Number of windows not specified") - if windows_area is not None: - # TODO - we don't have a price for this so we can't recommend it - print("We have windows area, we should use this data for our recommendations!!!") - # We scale the number of windows based on the proportion of existing glazing if self.property.data["multi-glaze-proportion"] != "": @@ -118,7 +120,10 @@ class WindowsRecommendations: is_secondary_glazing=is_secondary_glazing, ) - already_installed = "windows_glazing" in self.property.already_installed + measure_type = "double_glazing" if not is_secondary_glazing else "secondary_glazing" + + already_installed = measure_type in self.property.already_installed + if already_installed: cost_result = override_costs(cost_result) description = "The property already has double glazing installed. No further action is required." @@ -126,7 +131,7 @@ class WindowsRecommendations: glazing_type = ( "secondary glazing" if is_secondary_glazing else "double glazing" ) - if self.property.windows["glazing_coverage"] in ["partial", "most"]: + if self.property.windows["glazing_coverage"] in ["partial", "most"] and not double_glazing_replacement: description = f"Install {glazing_type} to the remaining windows" else: description = f"Install {glazing_type} to all windows" @@ -234,8 +239,6 @@ class WindowsRecommendations: "glazed-type": glazed_type_ending, } - measure_type = "double_glazing" if not is_secondary_glazing else "secondary_glazing" - non_invasive_recommendation = next( (r for r in self.property.non_invasive_recommendations if r["type"] in ["windows_glazing", measure_type]), {}