From f21221d721049444c82bce084199421aab19ce23 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 3 May 2024 16:08:14 +0100 Subject: [PATCH] working on ashp recommendations --- recommendations/Recommendations.py | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/recommendations/Recommendations.py b/recommendations/Recommendations.py index 0942ab12..c8113cdc 100644 --- a/recommendations/Recommendations.py +++ b/recommendations/Recommendations.py @@ -123,11 +123,28 @@ class Recommendations: self.heating_recommender.heating_recommendations or self.heating_recommender.heating_control_recommendations ): - if self.heating_recommender.heating_recommendations: - property_recommendations.append(self.heating_recommender.heating_recommendations) - if self.heating_recommender.heating_control_recommendations: - property_recommendations.append(self.heating_recommender.heating_control_recommendations) + # We split into first and second phase recommendations + first_phase_recommendations = [ + r for r in ( + self.heating_recommender.heating_recommendations + + self.heating_recommender.heating_control_recommendations + ) + if r["phase"] == phase + ] + second_phase_recommendations = [ + r for r in ( + self.heating_recommender.heating_recommendations + + self.heating_recommender.heating_control_recommendations + ) + if r["phase"] == phase + 1 + ] + + if first_phase_recommendations: + property_recommendations.append(first_phase_recommendations) + + if second_phase_recommendations: + property_recommendations.append(second_phase_recommendations) # We check if we have distinct heating and heating controls recommendations # If so, we increment by 2 (one of the heating system, one for the heating controls)