mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
handling error cases in storing data to db for estimated properties
This commit is contained in:
parent
41749e8557
commit
1eb6f4c2a7
2 changed files with 3 additions and 1 deletions
|
|
@ -459,7 +459,7 @@ class Property(Definitions):
|
|||
"""
|
||||
Utility function for usage in the lambda, for preparing the _rating fields
|
||||
"""
|
||||
return rating_lookup[field].value if field not in cls.DATA_ANOMALY_MATCHES else None
|
||||
return rating_lookup[field].value if (field not in cls.DATA_ANOMALY_MATCHES) and (field is not None) else None
|
||||
|
||||
def get_property_details_epc(self, portfolio_id: int, rating_lookup):
|
||||
|
||||
|
|
|
|||
|
|
@ -591,6 +591,7 @@ class SearchEpc:
|
|||
|
||||
estimated_epc["postcode"] = self.postcode
|
||||
estimated_epc["uprn"] = self.uprn
|
||||
estimated_epc["address"] = self.full_address
|
||||
# Indicate that this epc was estimated
|
||||
estimated_epc["estimated"] = True
|
||||
|
||||
|
|
@ -676,6 +677,7 @@ class SearchEpc:
|
|||
return
|
||||
|
||||
# Step 4: If we still don't have an EPC, we estimate the EPC data
|
||||
self.full_address = self.ordnance_survey_client.most_relevant_result["ADDRESS"]
|
||||
estimated_epc = self.estimate_epc(
|
||||
property_type=self.ordnance_survey_client.property_type,
|
||||
built_form=self.ordnance_survey_client.built_form
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue