diff --git a/backend/Property.py b/backend/Property.py index dc847750..be60784c 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -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): diff --git a/backend/SearchEpc.py b/backend/SearchEpc.py index 4953b04c..6e17d200 100644 --- a/backend/SearchEpc.py +++ b/backend/SearchEpc.py @@ -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