From 35ed1491fec36cbf5bb4ade80810dcb9156e6204 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 9 Feb 2026 18:04:09 +0000 Subject: [PATCH] handling 'unknown' fuel type --- backend/Property.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/backend/Property.py b/backend/Property.py index 14f7e03f..6a84fc09 100644 --- a/backend/Property.py +++ b/backend/Property.py @@ -1256,7 +1256,8 @@ class Property: "biodiesel": "Smokeless Fuel", "b30d": "B30K Biofuel", "coal": "Coal", - "oil": "Oil" + "oil": "Oil", + "unknown": None # Handle - anything post 2020 is electricity else gas } self.heating_energy_source = list({ @@ -1326,7 +1327,16 @@ class Property: if self.heating_energy_source == "Varied (Community Scheme)": if self.main_fuel["fuel_type"] in fuel_map: # We assume when None as it's unknown - self.heating_energy_source = fuel_map[self.main_fuel["fuel_type"]] + mapped_to = fuel_map[self.main_fuel["fuel_type"]] + if mapped_to is None and self.main_fuel["fuel_type"] == "unknown": + # Handle logic based on age band + if self.year_built >= 2020: + self.heating_energy_source = "Electricity" + else: + self.heating_energy_source = "Natural Gas (Community Scheme)" + + else: + self.heating_energy_source = mapped_to else: raise NotImplementedError(f"Unhandled fuel {self.main_fuel['fuel_type']}")