handle bug where neigther ewi or iwi are selected as options via optimisation

This commit is contained in:
Khalim Conn-Kowlessar 2023-12-05 13:30:45 +00:00
parent a45164e29e
commit db7eb69dd1
2 changed files with 15 additions and 0 deletions

View file

@ -298,6 +298,17 @@ async def trigger_plan(body: PlanTriggerRequest):
t for t in missing_types if t not in ["internal_wall_insulation", "external_wall_insulation"]
]
# We check if NO wall insulation was selected but iwi and ewi are available
# This condition will check
# 1) iwi and ewi are both in missing_types
# 2) iwi and ewi are not in default_types
# If both of these are true, it means that no wall insulation was selected via the optimisation routine
# but both are possible, so we need to select a default. We default to iwi because it's usually cheaper
if (("internal_wall_insulation" in missing_types) and ("external_wall_insulation" in missing_types)) and (
("internal_wall_insulation" not in default_types) and ("external_wall_insulation" not in default_types)
):
missing_types = [t for t in missing_types if t != "external_wall_insulation"]
if missing_types:
for missed_type in missing_types:
missed = [r for r in property_recommendations if r["type"] == missed_type]

View file

@ -15,6 +15,10 @@ class PropertyValuation:
100071264896: 128000,
# Based on next door neighbour: https://themovemarket.com/tools/propertyprices/flat-2-queens-wood-house-219
# -brandwood-road-birmingham-b14-6pu
100070533688: 218000, # Based on Zoopla's estimation of 95 Tenby Road, which is also end terrace
100070505235: 344000, # Based on Zoopla's estimation of 131 School road, which is also semi-detached
100070513306: 182000, # Based on Zoopla's estimation of 61 Simmons Drive
100071306896: 77000, # Based on Flat 2 of 44 Wedgewood Road on Zoopla
}
# We base our valuation uplifts on a number of sources