diff --git a/backend/Funding.py b/backend/Funding.py index c94ccc00..33c94e11 100644 --- a/backend/Funding.py +++ b/backend/Funding.py @@ -358,11 +358,13 @@ class Funding: # Format the starting U-value according to special rules if closest_starting == 0.45: - starting_str = "2" + starting_str = "0.45" elif closest_starting == 2.00: starting_str = "2.0" elif closest_starting == 1.70: starting_str = "1.7" + elif closest_starting == 1: + starting_str = "1.0" else: starting_str = f"{closest_starting:.2f}" @@ -618,7 +620,7 @@ class Funding: ] if solar_pps_df.empty and self.starting_sap_band in [ - "Low_C", "High_C", "Low_B", "High_B", "Low_B", "High_A" + "Low_C", "High_C", "Low_B", "High_B", "Low_B", "High_A", "Low_A" ]: # No funding for EPC C or above return 0 @@ -670,6 +672,9 @@ class Funding: return 0 if measure_type in ["double_glazing", "secondary_glazing"]: + # No funding for EPC C or above + if self.starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"]: + return 0 # pps is under the WG_singletodouble Measure_Type pps = filtered_pps_matrix[ filtered_pps_matrix["Measure_Type"] == "WG_singletodouble" @@ -716,12 +721,15 @@ class Funding: else: pps = filtered_pps_matrix[ (filtered_pps_matrix["Pre_Main_Heating_Source"] == pre_heating_system) & - (filtered_pps_matrix["Post_Main_Heating_Source"] == "Condensing Gas Boiler") & - (filtered_pps_matrix["Measure_Type"] == "B_Upgrade_preHCs") + (filtered_pps_matrix["Post_Main_Heating_Source"] == "Condensing Gas Boiler") + # (filtered_pps_matrix["Measure_Type"] == "B_Upgrade_preHCs") ] + # Depending on different systems, e.g. room heaters, we take the best options + if pps.shape[0] > 1: + pps = pps[pps["Cost Savings"] == min(pps["Cost Savings"])].head(1) # No funding for EPC C or above - if self.starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"] and pps.empty: + if self.starting_sap_band in ["Low_C", "High_C", "Low_B", "High_B", "Low_A", "High_A"] or pps.empty: return 0 if pps.shape[0] != 1: