diff --git a/backend/Property.py b/backend/Property.py index a1bfe265..618dfd67 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -377,7 +377,9 @@ class Property: x["type"] != "internal_wall_insulation" ] else: - epc_transformations = [x["description_simulation"] for x in represenative_recs_to_this_phase] + epc_transformations = [ + x["description_simulation"] for x in represenative_recs_to_this_phase + ] # It is possible that we could have two simulations applied to the same descriptions # We extract these out @@ -407,7 +409,8 @@ class Property: continue raise NotImplementedError( - "Already have this key in the phase_epc_transformation - implement me") + "Already have this key in the phase_epc_transformation - implement me" + ) phase_epc_transformation[k] = v simulation_epc = self.epc_record.prepared_epc.copy() diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index 0469f501..81c26e15 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -230,6 +230,16 @@ class Recommendations: # When check if these recommendations have two different types, such as solid wall insulation # If we have multiple types, we group by type and then select the best recommendation for each type + # If we have a heating and heating control recommendation, we use JUST the heating reommendation + has_both_heating_types = all( + x in [rec["type"] for rec in recommendations_by_type] for x in ["heating", "heating_control"] + ) + if has_both_heating_types: + # Take just heating + recommendations_by_type = [ + rec for rec in recommendations_by_type if rec["type"] == "heating" + ] + recommendations_by_type = sorted(recommendations_by_type, key=lambda x: x["type"]) representative_recommendations = [] for _type, recommendations in groupby(recommendations_by_type, key=lambda x: x["type"]):