diff --git a/app/models/validations/financial_validations.rb b/app/models/validations/financial_validations.rb index f6b769c16..72fabac4f 100644 --- a/app/models/validations/financial_validations.rb +++ b/app/models/validations/financial_validations.rb @@ -36,7 +36,6 @@ module Validations::FinancialValidations end def validate_hbrentshortfall(record) - is_present = record.hbrentshortfall.present? is_yes = record.hbrentshortfall == "Yes" hb_donotknow = record.hb == "Do not know" @@ -45,10 +44,10 @@ module Validations::FinancialValidations hb_no_uc = record.hb == "Housing Benefit, but not Universal Credit" hb_uc_no_he_hb = record.hb == "Universal Credit with housing element, but not Housing Benefit" hb_and_uc = record.hb == "Universal Credit and Housing Benefit" - + conditions = [ { condition: is_yes && (hb_donotknow || hb_no_hb_or_uc || hb_uc_no_hb), error: "Outstanding amount for basic rent and/or benefit eligible charges can not be 'Yes' if tenant is not in receipt of housing benefit or universal benefit or if benefit is unknown" }, - { condition: (hb_no_uc || hb_uc_no_he_hb || hb_and_uc) && !is_present, error: "Must be completed if Universal credit and/or Housing Benefit received" } + { condition: (hb_no_uc || hb_uc_no_he_hb || hb_and_uc) && !is_present, error: "Must be completed if Universal credit and/or Housing Benefit received" }, ] conditions.each { |condition| condition[:condition] ? (record.errors.add :hbrentshortfall, condition[:error]) : nil }