mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
Updating recommendation engine for new cost data
This commit is contained in:
parent
bf2e6c1ebc
commit
02b76cd9fe
4 changed files with 5 additions and 6 deletions
|
|
@ -75,7 +75,7 @@ def upload_recommendations(session: Session, recommendations_to_upload, property
|
||||||
"property_id": property_id,
|
"property_id": property_id,
|
||||||
"type": rec["type"],
|
"type": rec["type"],
|
||||||
"description": rec["description"],
|
"description": rec["description"],
|
||||||
"estimated_cost": rec["cost"],
|
"estimated_cost": rec["total"],
|
||||||
"default": rec["default"],
|
"default": rec["default"],
|
||||||
"starting_u_value": rec.get("starting_u_value"),
|
"starting_u_value": rec.get("starting_u_value"),
|
||||||
"new_u_value": rec.get("new_u_value"),
|
"new_u_value": rec.get("new_u_value"),
|
||||||
|
|
@ -102,10 +102,10 @@ def upload_recommendations(session: Session, recommendations_to_upload, property
|
||||||
{
|
{
|
||||||
"recommendation_id": recommendation_id,
|
"recommendation_id": recommendation_id,
|
||||||
"material_id": part["id"],
|
"material_id": part["id"],
|
||||||
"depth": part["depths"][0] if part["depths"] else None,
|
"depth": int(part["depth"]) if part["depth"] else None,
|
||||||
"quantity": part["quantity"],
|
"quantity": part["quantity"],
|
||||||
"quantity_unit": part["quantity_unit"],
|
"quantity_unit": part["quantity_unit"],
|
||||||
"estimated_cost": part["estimated_cost"],
|
"estimated_cost": part["total"],
|
||||||
}
|
}
|
||||||
for rec, recommendation_id in zip(recommendations_to_upload, uploaded_recommendation_ids)
|
for rec, recommendation_id in zip(recommendations_to_upload, uploaded_recommendation_ids)
|
||||||
for part in rec["parts"]
|
for part in rec["parts"]
|
||||||
|
|
|
||||||
|
|
@ -318,7 +318,6 @@ async def trigger_plan(body: PlanTriggerRequest):
|
||||||
batch_properties = input_properties[i:i + BATCH_SIZE]
|
batch_properties = input_properties[i:i + BATCH_SIZE]
|
||||||
|
|
||||||
for p in batch_properties:
|
for p in batch_properties:
|
||||||
|
|
||||||
# Your existing operations
|
# Your existing operations
|
||||||
property_details_epc = p.get_property_details_epc(
|
property_details_epc = p.get_property_details_epc(
|
||||||
portfolio_id=body.portfolio_id, rating_lookup=rating_lookup
|
portfolio_id=body.portfolio_id, rating_lookup=rating_lookup
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ class VentilationRecommendations(Definitions):
|
||||||
|
|
||||||
estimated_cost = n_units * part[0]["cost"]
|
estimated_cost = n_units * part[0]["cost"]
|
||||||
|
|
||||||
part[0]["estimated_cost"] = estimated_cost
|
part[0]["total"] = estimated_cost
|
||||||
part[0]["quantity"] = n_units
|
part[0]["quantity"] = n_units
|
||||||
part[0]["quantity_unit"] = "part"
|
part[0]["quantity_unit"] = "part"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ def prepare_input_measures(property_recommendations, goal):
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"id": rec["recommendation_id"],
|
"id": rec["recommendation_id"],
|
||||||
"cost": rec["cost"],
|
"cost": rec["total"],
|
||||||
"gain": rec[goal_key],
|
"gain": rec[goal_key],
|
||||||
"type": rec["type"]
|
"type": rec["type"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue