|
|
@ -66,7 +66,8 @@ module Validations::HouseholdValidations |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def validate_condition_effects(record) |
|
|
|
def validate_condition_effects(record) |
|
|
|
if has_illness?(record) && record.illness != 0 |
|
|
|
all_options = [record.illness_type_1, record.illness_type_2, record.illness_type_3, record.illness_type_4, record.illness_type_5, record.illness_type_6, record.illness_type_7, record.illness_type_8, record.illness_type_9, record.illness_type_10] |
|
|
|
|
|
|
|
if all_options.count(1) >= 1 && household_no_illness?(record) |
|
|
|
record.errors.add :condition_effects, I18n.t("validations.household.condition_effects.no_choices") |
|
|
|
record.errors.add :condition_effects, I18n.t("validations.household.condition_effects.no_choices") |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
@ -113,9 +114,8 @@ module Validations::HouseholdValidations |
|
|
|
|
|
|
|
|
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def has_illness?(record) |
|
|
|
def household_no_illness?(record) |
|
|
|
all_options = [record.illness_type_1, record.illness_type_2, record.illness_type_3, record.illness_type_4, record.illness_type_5, record.illness_type_6, record.illness_type_7, record.illness_type_8, record.illness_type_9, record.illness_type_10] |
|
|
|
record.illness != 0 |
|
|
|
all_options.count(1) >= 1 |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def women_of_child_bearing_age_in_household(record) |
|
|
|
def women_of_child_bearing_age_in_household(record) |
|
|
|