diff --git a/recommendations/RoofRecommendations.py b/recommendations/RoofRecommendations.py index fbd99d67..2a77a3a5 100644 --- a/recommendations/RoofRecommendations.py +++ b/recommendations/RoofRecommendations.py @@ -446,20 +446,7 @@ class RoofRecommendations: _, new_u_value = calculate_u_value_uplift(u_value, part_u_value) new_u_value = math.ceil(new_u_value * 100.0) / 100.0 - # If I have a lowest U value and my new u value is higher than that but lower than the - # diminishing returns threshold, it can be considered - - # If I have a lowest U value and my new u value is lower than the lowest value, it's - # further into the diminishing returns threshold and can shouldn't be - - # if is_diminishing_returns( - # recommendations, new_u_value, lowest_selected_u_value, self.DIMINISHING_RETURNS_U_VALUE - # ): - # continue - # We allow a small tolerance for error so we don't discount the recommendation entirely - # if new_u_value <= self.BUILDING_REGULATIONS_PART_L_MAX_U_VALUE: - # lowest_selected_u_value = update_lowest_selected_u_value(lowest_selected_u_value, new_u_value) estimated_cost = ( cost_per_unit * self.property.insulation_floor_area if @@ -504,7 +491,7 @@ class RoofRecommendations: "type": "room_roof_insulation", "description": "Insulate room in roof at rafters and re-decorate", "starting_u_value": u_value, - "new_u_value": None, + "new_u_value": new_u_value, "sap_points": sap_points, "simulation_config": simulation_config, "description_simulation": { diff --git a/recommendations/tests/test_roof_recommendations.py b/recommendations/tests/test_roof_recommendations.py index e7a4c540..910aef02 100644 --- a/recommendations/tests/test_roof_recommendations.py +++ b/recommendations/tests/test_roof_recommendations.py @@ -166,37 +166,33 @@ class TestRoofRecommendations: assert len(roof_recommender6.recommendations) == 0 - # def test_uninsulated_room_in_roof(self): - # property_instance7 = Property(id=0, address1="fake", postcode="fake", epc_client=Mock()) - # property_instance7.age_band = "F" - # property_instance7.insulation_floor_area = 100 - # property_instance7.roof = { - # 'original_description': 'Roof room(s), no insulation (assumed)', - # 'clean_description': 'Roof room(s), no insulation', - # 'thermal_transmittance': None, 'thermal_transmittance_unit': None, 'is_pitched': False, - # 'is_roof_room': True, 'is_loft': False, 'is_flat': False, 'is_thatched': False, 'is_at_rafters': False, - # 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True, 'insulation_thickness': 'none' - # } - # - # property_instance7.pitched_roof_area = 110 - # property_instance7.data = {"county": "Southampton"} - # - # roof_recommender7 = RoofRecommendations(property_instance=property_instance7, materials=materials) - # - # assert not roof_recommender7.recommendations - # - # roof_recommender7.recommend() - # - # # Even though we have 3 depths, we only end with 1 due to diminishin returns - # assert len(roof_recommender7.recommendations) == 1 - # - # assert roof_recommender7.recommendations[0]["parts"][0]["depths"] == [270] - # - # assert roof_recommender7.recommendations[0]["new_u_value"] == 0.14 - # assert roof_recommender7.recommendations[0]["starting_u_value"] == 0.8 - # assert roof_recommender7.recommendations[0]["description"] == \ - # "Insulate your room roof with 270mm of Example room roof insulation" - # + def test_uninsulated_room_in_roof(self): + epc_record = EPCRecord() + epc_record.prepared_epc = {"county": "Southampton", "roof-energy-eff": "Very Poor"} + property_instance7 = Property(id=0, address="fake", postcode="fake", epc_record=epc_record) + property_instance7.age_band = "F" + property_instance7.insulation_floor_area = 100 + property_instance7.roof = { + 'original_description': 'Roof room(s), no insulation (assumed)', + 'clean_description': 'Roof room(s), no insulation', + 'thermal_transmittance': None, 'thermal_transmittance_unit': None, 'is_pitched': False, + 'is_roof_room': True, 'is_loft': False, 'is_flat': False, 'is_thatched': False, 'is_at_rafters': False, + 'is_assumed': True, 'has_dwelling_above': False, 'is_valid': True, 'insulation_thickness': 'none' + } + + property_instance7.pitched_roof_area = 110 + + roof_recommender7 = RoofRecommendations(property_instance=property_instance7, materials=materials) + + assert not roof_recommender7.recommendations + + roof_recommender7.recommend(phase=0) + + assert len(roof_recommender7.recommendations) == 1 + assert roof_recommender7.recommendations[0]["new_u_value"] == 0.23 + assert roof_recommender7.recommendations[0]["starting_u_value"] == 1.5 + assert roof_recommender7.recommendations[0]["description"] == "Insulate room in roof at rafters and re-decorate" + # def test_ceiling_insulated_room_in_roof(self): # property_instance8 = Property(id=8, address1="fake", postcode="fake", epc_client=Mock()) # property_instance8.age_band = "F"