corrected parsing of overrides

This commit is contained in:
Khalim Conn-Kowlessar 2024-04-12 15:11:51 +01:00
parent ab180f6522
commit 8e2d823693
3 changed files with 9 additions and 6 deletions

View file

@ -60,7 +60,7 @@ class Property:
n_bedrooms = None
def __init__(
self, id, postcode, address, epc_record, overrides=None, **kwargs
self, id, postcode, address, epc_record, override=None, **kwargs
):
self.epc_record = epc_record
@ -77,7 +77,7 @@ class Property:
# This is a list of measures that have already been installed in the property, typically found as a result
# of the non-invasive surveys. We reflect that this has been installed in the recommendations, but remove the
# cost and instead, provide a message that the measure has already been installed
self.overrides = overrides
self.override = override
self.uprn = epc_record.get("uprn")
self.full_sap_epc = epc_record.get("full_sap_epc")

View file

@ -133,7 +133,7 @@ async def trigger_plan(body: PlanTriggerRequest):
patch = next((
x for x in patches if (x["address"] == config["address"]) and (x["postcode"] == config["postcode"])
), None)
), {})
epc_records = patch_epc(patch, epc_records)
prepared_epc = EPCRecord(
@ -142,16 +142,16 @@ async def trigger_plan(body: PlanTriggerRequest):
cleaning_data=cleaning_data
)
overrides = next((
override = next((
x for x in overrides if (x["address"] == config["address"]) and (x["postcode"] == config["postcode"])
), None)
), {})
input_properties.append(
Property(
id=property_id,
address=epc_searcher.address_clean,
postcode=epc_searcher.postcode_clean,
epc_record=prepared_epc,
overrides=overrides,
override=override,
**Property.extract_kwargs(config)
)
)

View file

@ -39,6 +39,9 @@ patches = [
'floor-description': 'Solid, no insulation (assumed)',
'secondheat-description': 'None',
'current-energy-efficiency': '32',
'energy-consumption-current': '491',
'co2-emissions-current': '5.0',
'potential-energy-efficiency': '87'
}
]