Merge pull request #508 from Hestia-Homes/eco-eligiblity-bug

handle case of property already EPC C or above for funding
This commit is contained in:
KhalimCK 2025-10-10 17:31:05 +01:00 committed by GitHub
commit 1869de9649
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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.