@ -53,9 +53,14 @@ class CaseLogValidator < ActiveModel::Validator
if["Full-time - 30 hours or more","Part-time - Less than 30 hours"].include?(record.tenant_economic_status)&&record.net_income_uc_proportion=="All"
if["Full-time - 30 hours or more","Part-time - Less than 30 hours"].include?(record.tenant_economic_status)&&record.net_income_uc_proportion=="All"
record.errors.add:net_income_uc_proportion,"income is from Universal Credit, state pensions or benefits cannot be All if person works part or full time"
record.errors.add:net_income_uc_proportion,"income is from Universal Credit, state pensions or benefits cannot be All if person works part or full time"
if(fields.any?{|field|["Full-time - 30 hours or more","Part-time - Less than 30 hours"].include?(field[:status])&&field[:relationship]=="Partner"})&&record.net_income_uc_proportion=="All"
record.errors.add:net_income_uc_proportion,"income is from Universal Credit, state pensions or benefits cannot be All if the partner works part or full time"
end
end
end
defvalidate(record)
defvalidate(record)
@ -74,14 +79,6 @@ class CaseLogValidator < ActiveModel::Validator
if["Full-time - 30 hours or more","Part-time - Less than 30 hours"].include?(person_field)&&relationship_field=="Partner"&&record.net_income_uc_proportion=="All"
record.errors.add:net_income_uc_proportion,"income is from Universal Credit, state pensions or benefits cannot be All if the partner works part or full time"