mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-07-12 13:29:04 +00:00
handling 'unknown' fuel type
This commit is contained in:
parent
294c12fe4c
commit
35ed1491fe
1 changed files with 12 additions and 2 deletions
|
|
@ -1256,7 +1256,8 @@ class Property:
|
||||||
"biodiesel": "Smokeless Fuel",
|
"biodiesel": "Smokeless Fuel",
|
||||||
"b30d": "B30K Biofuel",
|
"b30d": "B30K Biofuel",
|
||||||
"coal": "Coal",
|
"coal": "Coal",
|
||||||
"oil": "Oil"
|
"oil": "Oil",
|
||||||
|
"unknown": None # Handle - anything post 2020 is electricity else gas
|
||||||
}
|
}
|
||||||
|
|
||||||
self.heating_energy_source = list({
|
self.heating_energy_source = list({
|
||||||
|
|
@ -1326,7 +1327,16 @@ class Property:
|
||||||
if self.heating_energy_source == "Varied (Community Scheme)":
|
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
|
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:
|
else:
|
||||||
raise NotImplementedError(f"Unhandled fuel {self.main_fuel['fuel_type']}")
|
raise NotImplementedError(f"Unhandled fuel {self.main_fuel['fuel_type']}")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue