Merge pull request #391 from Hestia-Homes/remote-assessment-api

enable patching via remote assessment
This commit is contained in:
KhalimCK 2025-04-14 20:37:00 +01:00 committed by GitHub
commit 8d65f5b1e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 5 deletions

View file

@ -520,10 +520,11 @@ async def trigger_plan(body: PlanTriggerRequest):
# if we have a remote assment data type, we pull the additional data and include it
if body.event_type == "remote_assessment":
logger.info("Retrieving find my epc data")
property_non_invasive_recommendations = RetrieveFindMyEpc.get_from_epc(
epc_searcher.newest_epc
)
# TODO: We need to determine if we should make a patch, if the EPC is new
for k in ["address", "address1"]:
epc_searcher.newest_epc[k] = epc_searcher.address_clean
property_non_invasive_recommendations, patch = RetrieveFindMyEpc.get_from_epc(epc_searcher.newest_epc)
# If we have a property type, this means when we pull the epc data, we might need to make a patch
epc_records = patch_epc(patch, epc_records)

View file

@ -477,4 +477,13 @@ class RetrieveFindMyEpc:
"recommendations": find_epc_data["recommendations"],
}
return non_invasive_recommendations
# We need to add the patch information
patch = {
"current-energy-rating": find_epc_data["current_epc_rating"],
"current-energy-efficiency": find_epc_data["current_epc_efficiency"],
"potential-energy-rating": find_epc_data["potential_epc_rating"],
"potential-energy-efficiency": find_epc_data["potential_epc_efficiency"],
**find_epc_data["epc_data"],
}
return non_invasive_recommendations, patch