made mains gas flag boolean

This commit is contained in:
Khalim Conn-Kowlessar 2026-03-19 18:59:32 +00:00
parent 69af82a5db
commit ed37059581
3 changed files with 5 additions and 5 deletions

View file

@ -134,7 +134,7 @@ def extract_portfolio_aggregation_data(
lower_bound_valuation_uplift, upper_bound_valuation_uplift = 0, 0 lower_bound_valuation_uplift, upper_bound_valuation_uplift = 0, 0
agg_data.append({ agg_data.append({
"pre_retrofit_epc": p.data["current-energy-rating"], "pre_retrofit_epc": p.epc_record.current_energy_rating,
"post_retrofit_epc": new_epc_bands[p.id], "post_retrofit_epc": new_epc_bands[p.id],
"pre_retrofit_co2": pre_retrofit_co2, "pre_retrofit_co2": pre_retrofit_co2,
"post_retrofit_co2": post_retrofit_co2, "post_retrofit_co2": post_retrofit_co2,
@ -1145,7 +1145,7 @@ async def model_engine(body: PlanTriggerRequest):
optimiser.solve() optimiser.solve()
solution = optimiser.solution solution = optimiser.solution
gain = optimiser.solution_gain gain = optimiser.solution_gain
post_sap = int(p.data["current-energy-efficiency"]) + gain post_sap = p.epc_record.current_energy_efficiency + gain
pv_size = next( pv_size = next(
(m["array_size"] for m in solution if m["type"] == "solar_pv"), 0 (m["array_size"] for m in solution if m["type"] == "solar_pv"), 0
@ -1242,7 +1242,7 @@ async def model_engine(body: PlanTriggerRequest):
# This will include everything, including already installed # This will include everything, including already installed
total_sap_points = sum([r["sap_points"] for r in default_recommendations]) total_sap_points = sum([r["sap_points"] for r in default_recommendations])
new_sap_points = float(p.data["current-energy-efficiency"]) + total_sap_points new_sap_points = p.epc_record.current_energy_efficiency + total_sap_points
new_epc = sap_to_epc(new_sap_points) new_epc = sap_to_epc(new_sap_points)
# Already installed measures do not have a cost but we remove anyway # Already installed measures do not have a cost but we remove anyway
total_cost = sum([r["total"] for r in default_recommendations if not r["already_installed"]]) total_cost = sum([r["total"] for r in default_recommendations if not r["already_installed"]])

View file

@ -216,7 +216,7 @@ class PropertyValuation:
cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn) cls.UPRN_VALUE_LOOKUP.get(property_instance.uprn)
) )
current_epc = property_instance.data["current-energy-rating"] current_epc = property_instance.epc_record.current_energy_rating
if not current_value: if not current_value:
# In this case, we return a % improvement rather than an absolute # In this case, we return a % improvement rather than an absolute

View file

@ -186,7 +186,7 @@ class EPCRecord:
heat_loss_corridor: Optional[str] = None heat_loss_corridor: Optional[str] = None
unheated_corridor_length: Optional[float] = None unheated_corridor_length: Optional[float] = None
mains_gas_flag: Optional[str] = None mains_gas_flag: Optional[bool] = None
# ------------------------------------------------------------------ # ------------------------------------------------------------------
# BUILDING FABRIC DESCRIPTIONS # BUILDING FABRIC DESCRIPTIONS