handled bug for dual primary heating

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-19 18:09:10 +01:00
parent 1fda0dc237
commit 38eaa52e6c

View file

@ -93,7 +93,7 @@ class Property:
self.data = {
k.replace("_", "-"): v for k, v in epc_record.get("prepared_epc").items()
}
self.old_data = epc_record.get("old_data")
self.property_dimensions = None
# This is a list of measures that have already been installed in the property, typically found as a result
@ -1181,6 +1181,14 @@ class Property:
self.heating_energy_source = list({
fuel for key, fuel in heating_fuel_mapping.items() if self.main_heating.get(key, False)
})
if set(self.heating_energy_source) == {'Electricity', 'Natural Gas'}:
# It means they have mixed heating so we take the primary one, based on main fuel
if self.main_fuel["clean_description"] == "Mains gas not community":
self.heating_energy_source = ['Natural Gas']
else:
self.heating_energy_source = ['Electricity']
if len(self.heating_energy_source) == 0 or len(self.heating_energy_source) > 1:
raise Exception("Investigate me")