diff --git a/recommendations/tests/test_optimisers.py b/recommendations/tests/test_optimisers.py index 762ab71e..394e741d 100644 --- a/recommendations/tests/test_optimisers.py +++ b/recommendations/tests/test_optimisers.py @@ -494,17 +494,12 @@ def _find_measure(input_measures, measure_type): def make_funding_paths(input_measures, tenure): - """ - Given the tenure of the property and the available measures, this function will construct the funding paths - :return: - """ - - funding_paths = [] - if tenure == "Social": raise NotImplementedError("Implement me!") - if tenure == "Private": + funding_paths = [] + + if tenure == "Private" # We cover off the main funding paths # 1) The package must include EWI or IWI # We check if we have any EWI or IWI measures available @@ -528,14 +523,14 @@ def make_funding_paths(input_measures, tenure): # 3) The package must have an existing eligible heating system. We test this with the funding checker # If we have any remaining insulation measure to be applied to the property, we also need to include that in # the package - single_solar_template = [{"OR": []}] + single_solar_template = [{"AND": []}] has_eligible_heating_system = funding.check_solar_eligible_heating_system( mainheat_description=p.main_heating["clean_description"], heating_control_description=p.main_heating_controls["clean_description"] ) if has_eligible_heating_system: - single_solar_template[0]["OR"].append("solar_pv") + single_solar_template[0]["AND"].append("solar_pv") # We now look to pair this with any lingering insulation measures wall_insulation_measures = [ "internal_wall_insulation", "external_wall_insulation", "cavity_wall_insulation", @@ -557,6 +552,18 @@ def make_funding_paths(input_measures, tenure): solar_paths_with_insulation.append(single_solar_template) funding_paths.extend(solar_paths_with_insulation) + else: + # If we don't have an eligible heating system, we check if we have an eligible heating system + # (HHRSH/ASHP/Electric boiler) + solar PV + if _find_measure(input_measures, "solar_pv") and _find_measure(input_measures, + "high_heat_retention_storage_heater"): + funding_paths.append([{"AND": ["solar_pv", "high_heat_retention_storage_heater"]}]) + + if _find_measure(input_measures, "solar_pv") and _find_measure(input_measures, "air_source_heat_pump"): + funding_paths.append([{"AND": ["solar_pv", "air_source_heat_pump"]}]) + + if _find_measure(input_measures, "solar_pv") and _find_measure(input_measures, "electric_boiler"): + funding_paths.append([{"AND": ["solar_pv", "electric_boiler"]}]) # ---- main wrapper around your optimiser ----------------------------------