From 69424149510c38f59d1d847cbcef740a287da23b Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 11 Apr 2024 15:40:50 +0100 Subject: [PATCH] Updating heating recommender to recommend heating controls, with the heating change --- backend/app/plan/router.py | 21 ++++++++++----------- recommendations/HeatingRecommender.py | 6 +++--- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/backend/app/plan/router.py b/backend/app/plan/router.py index 3cb2027d..4b91566e 100644 --- a/backend/app/plan/router.py +++ b/backend/app/plan/router.py @@ -108,17 +108,16 @@ async def trigger_plan(body: PlanTriggerRequest): property_id, is_new = create_property( session, body.portfolio_id, epc_searcher.address_clean, epc_searcher.postcode_clean, epc_searcher.uprn ) - # if a new record was not created, we don't produduce recommendations - # if not is_new: - # continue - # - # create_property_targets( - # session, - # property_id=property_id, - # portfolio_id=body.portfolio_id, - # epc_target=body.goal_value, - # heat_demand_target=None - # ) + if not is_new: + continue + + create_property_targets( + session, + property_id=property_id, + portfolio_id=body.portfolio_id, + epc_target=body.goal_value, + heat_demand_target=None + ) epc_records = { 'original_epc': epc_searcher.newest_epc.copy(), diff --git a/recommendations/HeatingRecommender.py b/recommendations/HeatingRecommender.py index d4fe0a90..6e4b2230 100644 --- a/recommendations/HeatingRecommender.py +++ b/recommendations/HeatingRecommender.py @@ -48,7 +48,7 @@ class HeatingRecommender: if has_boiler or no_heating_has_mains or electic_heating_has_mains: # This indicates that the home previously did not have a boiler in place and so would require - # an overhaul to the system + # an overhaul to the system - right now, this is all reasons, apart from if there is an existing boiler system_change = not has_boiler self.recommend_boiler_upgrades(phase=phase, system_change=system_change) @@ -353,8 +353,8 @@ class HeatingRecommender: if not controls_recommender.recommendation: return - if no_heating_has_mains: - # We combine the heating and controls recommendations + if system_change: + # We combine the heating and controls recommendations, in the case of a system change boiler_recommendation = self.recommendations[0].copy() combined_recommendations = [] for controls_recommendation in controls_recommender.recommendation: