diff --git a/recommendations/WindowsRecommendations.py b/recommendations/WindowsRecommendations.py index a8fd2a87..cd1b982b 100644 --- a/recommendations/WindowsRecommendations.py +++ b/recommendations/WindowsRecommendations.py @@ -194,6 +194,9 @@ class WindowsRecommendations: else: raise ValueError("Invalid glazing type - implement me") + if (self.property.data["windows-energy-eff"] in ["Good", "Very Good"]) and (windows_energy_eff == "Average"): + windows_energy_eff = self.property.data["windows-energy-eff"] + windows_ending_config = WindowAttributes(new_windows_description).process() windows_simulation_config = check_simulation_difference( diff --git a/recommendations/tests/test_window_recommendations.py b/recommendations/tests/test_window_recommendations.py index 02978051..6478d87d 100644 --- a/recommendations/tests/test_window_recommendations.py +++ b/recommendations/tests/test_window_recommendations.py @@ -15,7 +15,8 @@ class TestWindowRecommendations: epc_record.prepared_epc = { "county": "Wychavon", "multi-glaze-proportion": 0, - "uprn": 0 + "uprn": 0, + "windows-energy-eff": "Very Poor" } property_1 = Property( id=1, @@ -36,13 +37,25 @@ class TestWindowRecommendations: recommender.recommend() + # The home is going from single glazing (v poor energy eff) -> double glazing (average energy eff) + assert recommender.recommendation == [ - {'phase': 0, 'parts': [], 'type': 'windows_glazing', 'description': 'Install double glazing to all windows', - 'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False, - 'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': False, - 'description_simulation': {'multi-glaze-proportion': 100, 'windows-energy-eff': 'Average', - 'windows-description': 'Fully double glazed', - 'glazed-type': 'double glazing installed during or after 2002'}} + { + 'phase': 0, 'parts': [], 'type': 'windows_glazing', + 'description': 'Install double glazing to all windows', + 'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False, + 'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': False, + 'description_simulation': { + 'multi-glaze-proportion': 100, 'windows-energy-eff': 'Average', + 'windows-description': 'Fully double glazed', + 'glazed-type': 'double glazing installed during or after 2002' + }, + 'simulation_config': { + 'has_glazing_ending': True, 'glazing_type_ending': 'double', + 'multi_glaze_proportion_ending': 100, 'windows_energy_eff_ending': 'Average', + 'glazed_type_ending': 'double glazing installed during or after 2002' + } + } ] def test_partial_double_glazed(self): @@ -55,7 +68,8 @@ class TestWindowRecommendations: epc_record.prepared_epc = { "county": "Wychavon", "multi-glaze-proportion": 33, - "uprn": 0 + "uprn": 0, + "windows-energy-eff": "Good" # This has been observed in the EPC data } property_2 = Property( id=1, @@ -75,13 +89,23 @@ class TestWindowRecommendations: recommender2.recommend() assert recommender2.recommendation == [ - {'phase': 0, 'parts': [], 'type': 'windows_glazing', - 'description': 'Install double glazing to the remaining windows', 'starting_u_value': None, - 'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 5700.0, 'labour_hours': 0.0, - 'labour_days': 0.0, 'is_secondary_glazing': False, - 'description_simulation': {'multi-glaze-proportion': 100, 'windows-energy-eff': 'Average', - 'windows-description': 'Fully double glazed', - 'glazed-type': 'double glazing installed during or after 2002'}} + { + 'phase': 0, 'parts': [], 'type': 'windows_glazing', + 'description': 'Install double glazing to the remaining windows', 'starting_u_value': None, + 'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 5700.0, + 'labour_hours': 0.0, + 'labour_days': 0.0, 'is_secondary_glazing': False, + 'description_simulation': { + 'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good', + 'windows-description': 'Fully double glazed', + 'glazed-type': 'double glazing installed during or after 2002' + }, + 'simulation_config': { + 'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100, + 'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'double', + 'glazed_type_ending': 'double glazing installed during or after 2002' + } + } ] def test_fully_double_glazed(self): @@ -145,7 +169,8 @@ class TestWindowRecommendations: epc_record.prepared_epc = { "county": "Wychavon", "multi-glaze-proportion": 50, - "uprn": 0 + "uprn": 0, + "windows-energy-eff": "Poor" # This has been observed in the EPC data } property_5 = Property( id=1, @@ -165,13 +190,22 @@ class TestWindowRecommendations: recommender5.recommend() assert recommender5.recommendation == [ - {'phase': 0, 'parts': [], 'type': 'windows_glazing', - 'description': 'Install secondary glazing to the remaining windows', 'starting_u_value': None, - 'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 4560.0, 'labour_hours': 0.0, - 'labour_days': 0.0, 'is_secondary_glazing': True, - 'description_simulation': {'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good', - 'windows-description': 'Full secondary glazing', - 'glazed-type': 'secondary glazing'}} + { + 'phase': 0, 'parts': [], 'type': 'windows_glazing', + 'description': 'Install secondary glazing to the remaining windows', 'starting_u_value': None, + 'new_u_value': None, 'sap_points': None, 'already_installed': False, 'total': 4560.0, + 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True, + 'description_simulation': { + 'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good', + 'windows-description': 'Full secondary glazing', + 'glazed-type': 'secondary glazing' + }, + 'simulation_config': { + 'glazing_coverage_ending': 'full', 'multi_glaze_proportion_ending': 100, + 'windows_energy_eff_ending': 'Good', 'glazing_type_ending': 'secondary', + 'glazed_type_ending': 'secondary glazing' + } + } ] def test_single_glazed_restricted_measures(self): @@ -179,7 +213,8 @@ class TestWindowRecommendations: epc_record.prepared_epc = { "county": "Wychavon", "multi-glaze-proportion": 0, - "uprn": 0 + "uprn": 0, + "windows-energy-eff": "Very Poor" } property_6 = Property( @@ -202,14 +237,23 @@ class TestWindowRecommendations: recommender6.recommend() assert recommender6.recommendation == [ - {'phase': 0, 'parts': [], 'type': 'windows_glazing', - 'description': 'Install secondary glazing to all windows. Secondary glazing recommended due to herigate ' - 'building status', - 'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False, - 'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True, - 'description_simulation': {'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good', - 'windows-description': 'Full secondary glazing', - 'glazed-type': 'secondary glazing'}} + { + 'phase': 0, 'parts': [], 'type': 'windows_glazing', + 'description': 'Install secondary glazing to all windows. Secondary glazing recommended due to ' + 'herigate building status', + 'starting_u_value': None, 'new_u_value': None, 'sap_points': None, 'already_installed': False, + 'total': 7980.0, 'labour_hours': 0.0, 'labour_days': 0.0, 'is_secondary_glazing': True, + 'description_simulation': { + 'multi-glaze-proportion': 100, 'windows-energy-eff': 'Good', + 'windows-description': 'Full secondary glazing', + 'glazed-type': 'secondary glazing' + }, + 'simulation_config': { + 'has_glazing_ending': True, 'glazing_coverage_ending': 'full', + 'glazing_type_ending': 'secondary', 'multi_glaze_proportion_ending': 100, + 'windows_energy_eff_ending': 'Good', 'glazed_type_ending': 'secondary glazing' + } + } ] def test_full_triple_glazed(self):