From 504a714fc65ffe17f5f2c373ffeb3f0b2065956f Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 28 Oct 2025 13:43:10 +0000 Subject: [PATCH 1/2] fixed ranking algo for unfunded --- backend/engine/engine.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/backend/engine/engine.py b/backend/engine/engine.py index f2674290..f4152852 100644 --- a/backend/engine/engine.py +++ b/backend/engine/engine.py @@ -959,15 +959,19 @@ async def model_engine(body: PlanTriggerRequest): ) # Given the solutions we select the optimal one + # 1) If the scheme is ECO4, the full project funding and uplift are deducted from the cost + # 2) If the sheme is GBIS, the partial project funding and uplift are deducted from the cost + # 3) Otherwise, no funding is deducted from the cost solutions["cost_less_full_project_funding"] = np.where( - solutions["scheme"] == "eco4", - solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"], - solutions["total_cost"] - solutions["partial_project_funding"] - solutions["total_uplift"] + solutions["scheme"] == "none", + solutions["total_cost"], + np.where( + solutions["scheme"] == "eco4", + solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"], + solutions["total_cost"] - solutions["partial_project_funding"] - solutions["total_uplift"] + ) ) - solutions["cost_less_full_project_funding"] = ( - solutions["total_cost"] - solutions["full_project_funding"] - solutions["total_uplift"] - ) solutions = solutions.sort_values("cost_less_full_project_funding", ascending=True) if solutions["meets_upgrade_target"].any(): From b8fc16dac569a9282df0095168ae0868bb4cadf0 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Tue, 28 Oct 2025 14:41:28 +0000 Subject: [PATCH 2/2] added new measure --- backend/app/db/models/materials.py | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/app/db/models/materials.py b/backend/app/db/models/materials.py index 347b66d5..9b38addd 100644 --- a/backend/app/db/models/materials.py +++ b/backend/app/db/models/materials.py @@ -19,6 +19,7 @@ class MaterialType(enum.Enum): flat_roof_insulation = "flat_roof_insulation" room_roof_insulation = "room_roof_insulation" windows_glazing = "windows_glazing" + secondary_glazing = "secondary_glazing" cavity_wall_extraction = "cavity_wall_extraction" iwi_wall_demolition = "iwi_wall_demolition"