diff --git a/recommendations/recommendation_utils.py b/recommendations/recommendation_utils.py index 3364f0fa..d5788544 100644 --- a/recommendations/recommendation_utils.py +++ b/recommendations/recommendation_utils.py @@ -248,7 +248,7 @@ def extract_thickness(thickness, is_roof_room, is_at_rafters, is_loft, is_flat): thickness_map = { "below average": "50", "average": "100", - "above average": "270", + "above average": "150", "none": "0", } thickness = thickness_map[thickness] @@ -287,7 +287,7 @@ def get_u_value_from_s9( ): return None - if thickness in [0, "0"] and is_loft: + if thickness in [0, "0"] and (is_loft or is_roof_room): return None # Determine the column to refer based on the roof type diff --git a/recommendations/tests/test_data/roof_uvalue_test_cases.py b/recommendations/tests/test_data/roof_uvalue_test_cases.py index 1f230cc8..8bf8b35f 100644 --- a/recommendations/tests/test_data/roof_uvalue_test_cases.py +++ b/recommendations/tests/test_data/roof_uvalue_test_cases.py @@ -352,4 +352,115 @@ roof_uvalue_test_cases = [ 'age_band': 'L', 'uvalue': 0.18 }, + # Room roof - age band A + { + 'insulation_thickness': 'none', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'A', + 'uvalue': 2.3 + }, + { + 'insulation_thickness': 'below average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'A', + 'uvalue': 0.68 + }, + { + 'insulation_thickness': 'average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'A', + 'uvalue': 0.4 + }, + { + 'insulation_thickness': 'above average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'A', + 'uvalue': 0.3 + }, + # Room roof - age band E + { + 'insulation_thickness': 'none', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'E', + 'uvalue': 1.5 + }, + { + 'insulation_thickness': 'average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'E', + 'uvalue': 0.4 + }, + # Room roof - age band H + { + 'insulation_thickness': 'none', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'H', + 'uvalue': 0.35 + }, + { + 'insulation_thickness': 'below average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'H', + 'uvalue': 0.68 + }, + { + 'insulation_thickness': 'average', + 'is_loft': False, + 'is_roof_room': True, + 'is_thatched': False, + 'has_dwelling_above': False, + 'is_flat': False, + 'is_pitched': False, + 'is_at_rafters': False, + 'age_band': 'H', + 'uvalue': 0.4 + }, ] diff --git a/recommendations/tests/test_recommendation_utils.py b/recommendations/tests/test_recommendation_utils.py index b445a798..fa707b4b 100644 --- a/recommendations/tests/test_recommendation_utils.py +++ b/recommendations/tests/test_recommendation_utils.py @@ -198,7 +198,7 @@ class TestRecommendationUtils: } u_value = recommendation_utils.get_roof_u_value(**inputs) - assert u_value == 0.16, f"Expected 0.16, but got {u_value}" + assert u_value == 0.3, f"Expected 0.3, but got {u_value}" def test_get_roof_u_value_case_8(self): # Test case where there is a dwelling above the roof, U-value should be 0