allow costing for flats ewi

This commit is contained in:
Khalim Conn-Kowlessar 2024-05-21 14:12:03 +01:00
parent e95a2d0113
commit 0d1e49f1f3
4 changed files with 18 additions and 11 deletions

View file

@ -736,7 +736,10 @@ async def build_mds(body: PlanTriggerRequest):
p.get_components(cleaned, photo_supply_lookup, floor_area_decile_thresholds)
mds = Mds(property_instance=p, materials=materials)
mds.build()
property_representative_recommendations, errors = mds.build()
if errors:
logger.info("Errors occurred during MDS build")
except IntegrityError:

View file

@ -626,12 +626,10 @@ class Costs:
preliminaries_rate = self.EWI_SCAFFOLDING_PRELIMINARIES
else:
preliminaries_rate = self.EWI_NO_SCAFFOLDING_PRELIMINARIES
elif self.property.data["property-type"] == "Maisonette":
elif self.property.data["property-type"] in ["Maisonette", "Flat"]:
preliminaries_rate = self.EWI_SCAFFOLDING_PRELIMINARIES
elif self.property.data["property-type"] == "Bungalow":
preliminaries_rate = self.EWI_NO_SCAFFOLDING_PRELIMINARIES
else:
raise ValueError("Unsupported property type - haven't handled flats")
demolition_data = [x for x in non_insulation_materials if x["type"] == "ewi_wall_demolition"]
preparation_data = [x for x in non_insulation_materials if x["type"] == "ewi_wall_preparation"]

View file

@ -59,6 +59,7 @@ class Mds:
raise NotImplementedError("Not implemented measure in the property - implement me")
mds_recommendations = []
errors = []
# TODO: Could use a decarator to reduce the boilerplate code - insert_recommendation_id and then the append
@ -75,11 +76,15 @@ class Mds:
mds_recommendations.append(recs)
if "loft_insulation" in measure_config_list:
recs = self.roof_recommender.mds_loft_insulation(phase=0)
if not recs:
raise Exception("No recommendations for loft insulation")
recs = self.insert_recommendation_id(recs, measures, "loft_insulation")
mds_recommendations.append(recs)
# Check if the roof is suitable for loft insulation
if self.property_instance.roof['is_roof_room']:
errors.append("Roof is a room")
else:
recs = self.roof_recommender.mds_loft_insulation(phase=0)
if not recs:
raise Exception("No recommendations for loft insulation")
recs = self.insert_recommendation_id(recs, measures, "loft_insulation")
mds_recommendations.append(recs)
if "internal_wall_insulation" in measure_config_list:
raise Exception("check me out 4")
@ -104,7 +109,7 @@ class Mds:
recs = self.heating_recommender.recommend_hhr_storage_heaters(
phase=0, system_change=True, heating_controls_only=False, _return=True
)
recs = self.insert_recommendation_id(recs, measures)
recs = self.insert_recommendation_id(recs, measures, "electric_storage_heaters")
mds_recommendations.append(recs)
if "low_energy_lighting" in measure_config_list:
@ -156,6 +161,8 @@ class Mds:
mds_recommendations, non_invasive_recommendations=[]
)
return property_representative_recommendations, errors
@staticmethod
def insert_recommendation_id(recommendations, measures, measure_name):
# Insert the recommendation identifier into this recommendation

View file

@ -123,7 +123,6 @@ class WallRecommendations(Definitions):
def mds_recommend_ewi(self, phase=None):
# Function specifically for external wall insulation, for usage in the mds report
self.recommendations = []
insulation_thickness = self.property.walls["insulation_thickness"]
u_value = get_wall_u_value(
clean_description=self.property.walls["clean_description"],