From aa03ef1b0f4ce0162a383304d79b14d9629e4954 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 10 Oct 2025 15:59:38 +0100 Subject: [PATCH] handle case of property already EPC C or above for funding --- recommendations/optimiser/funding_optimiser.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/recommendations/optimiser/funding_optimiser.py b/recommendations/optimiser/funding_optimiser.py index 03824ea0..73475fc0 100644 --- a/recommendations/optimiser/funding_optimiser.py +++ b/recommendations/optimiser/funding_optimiser.py @@ -231,8 +231,8 @@ def optimise_with_funding_paths(p, input_measures, housing_type, funding: Fundin # We now produce a fabric only path for ECO4 # We add in generic insulation funding paths (where there is no fixed measure) # Heating controls are only eligible if installed as part of a heating upgrade and so we do not include them - # here - if housing_type == "Social": + # here. We don't have an option if the property is a C or above + if housing_type == "Social" and p.data["current-energy-rating"] not in ["C", "B", "A"]: funding_paths = ( [ { @@ -301,7 +301,6 @@ def optimise_with_funding_paths(p, input_measures, housing_type, funding: Fundin # We log an error and skip this - we should not see any errors but we can probably get a reasonable # outcome for the end user without a complete termination of the process logger.error("Skipping fixed selection due to minimum insulation violation: %s", fixed) - blah continue scheme = _path_scheme(path_spec) @@ -829,6 +828,11 @@ def make_funding_paths(p, input_measures, housing_type, funding: Funding): :param funding: The funding object that provides methods to check eligibility and calculate funding. :return: """ + + # If the property is currently EPC C, there is no funding availability + if p.data["current-energy-rating"] in ["C", "B", "A"]: + return [], input_measures + # We handle the case of minimum insulation requirements. Whenever we have a heating system recommendation, # we *must* include an additional insulation measure, unless the property already has sufficient insulation.