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

fixed find my epc fetch bug getting heating control instead of heating system
This commit is contained in:
KhalimCK 2025-11-06 13:09:00 +00:00 committed by GitHub
commit 84dbec3cd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions

View file

@ -663,7 +663,6 @@ async def model_engine(body: PlanTriggerRequest):
input_properties = OpenUprnClient.set_spatial_data(input_properties, bucket_name=get_settings().DATA_BUCKET)
[p.set_features(cleaned=cleaned, kwh_client=kwh_client, kwh_predictions=kwh_preds) for p in input_properties]
# TODO: If a property is semi-detached, we might get roof surfaces for the main building + the neighbour
# TODO: If we can't get high image quality, should we use the solar API? Maybe just for semi-detached units with
# extensions, since it doesn't seem to do a great job

View file

@ -73,6 +73,12 @@ class RetrieveFindMyEpc:
def get_feature_row_text(feature_name, index=0):
matches = [row for row in rows if row.find("th") and feature_name in row.find("th").text]
if len(matches) > index:
# A commonly seen case is when feature_name is Main heating and we want to make sure we get
# main heating and not main heating control
if feature_name == "Main heating":
matches = [
row for row in matches if row.find("th") and row.find("th").text.strip() == "Main heating"
]
cells = matches[index].find_all("td")
description = self.get_text(cells[0])
rating = self.get_text(cells[1])