diff --git a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py index 5dd9b6e1..3d0964c6 100644 --- a/etl/eligibility/ha_15_32/ha_analysis_batch_3.py +++ b/etl/eligibility/ha_15_32/ha_analysis_batch_3.py @@ -1164,15 +1164,33 @@ def get_epc_data( # condition 1 - identified for gbis and not eligible condition_1 = ( - identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront["eligible"] - ) & consider_penultimate_epc + identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront[ + "eligible"] + ) & consider_penultimate_epc # condition 2 - identified for eco4 and not eligible - condition_2 = ( - identified_for_eco4 and not eligibility.eco4_warmfront["eligible"] - ) & consider_penultimate_epc + condition_2 = (identified_for_eco4 and not eligibility.eco4_warmfront[ + "eligible"]) & consider_penultimate_epc - if identified_for_gbis and not eligibility.gbis_warmfront and not eligibility.eco4_warmfront["eligible"]: + # successfully identigied gbis + condition_3 = ( + identified_for_gbis and (eligibility.gbis_warmfront or eligibility.eco4_warmfront["eligible"]) + ) + + # Nothing identified + condition_4 = ( + not identified_for_gbis and not identified_for_eco4 and not eligibility.gbis_warmfront and not + eligibility.eco4_warmfront["eligible"] + ) + + # Not identified but seemingly eligible for eco4 or gbis + condition_5 = ( + not identified_for_gbis and not identified_for_eco4 and ( + eligibility.eco4_warmfront["eligible"] or eligibility.gbis_warmfront + ) + ) + + if condition_1 or condition_2: # We check the penultimate epc eligibility = Eligibility(epc=penultimate_epc, cleaned=cleaned) eligibility.check_gbis_warmfront() @@ -1181,10 +1199,11 @@ def get_epc_data( # We don't update just to make data cleaning easier if penultimate_epc.get("estimated") is None: older_epcs = [x for x in searcher.data["rows"] if x["lmk-key"] != penultimate_epc["lmk-key"]] - elif identified_for_eco4 and not eligibility.eco4_warmfront["eligible"]: - + elif condition_3 or condition_4 or condition_5: + # If we have successfully identified for gbis, we don't need to check the penultimate epc + pass else: - blah + NotImplementedError("Implement me") # If the property is a cavity wall and it's filled, we produce an estimate for the age of the cavity # Loft MUST be suitable @@ -1229,10 +1248,7 @@ def get_epc_data( "eco4_eligible": eligibility.eco4_warmfront["eligible"], "eco4_message": eligibility.eco4_warmfront["message"], "sap": float(eligibility.epc["current-energy-efficiency"]), - "gbis_eligible_future": eligibility.gbis["eligible"], - "gbis_eligible_future_message": eligibility.gbis["message"], - "eco4_eligible_future": eligibility.eco4["eligible"], - "eco4_eligible_future_message": eligibility.eco4["message"], + # Property components "roof": eligibility.roof["clean_description"], "walls": eligibility.walls["clean_description"],