|
|
|
@ -208,8 +208,7 @@ module Validations::SoftValidations |
|
|
|
def multiple_partners? |
|
|
|
def multiple_partners? |
|
|
|
return unless hhmemb |
|
|
|
return unless hhmemb |
|
|
|
|
|
|
|
|
|
|
|
max_person_with_details = sales? ? [hhmemb, 6].min : [hhmemb, 8].min |
|
|
|
(2..people_with_details).many? { |n| public_send("relat#{n}") == "P" } |
|
|
|
(2..max_person_with_details).many? { |n| public_send("relat#{n}") == "P" } |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def at_least_one_working_situation_is_sickness_and_household_sickness_is_no? |
|
|
|
def at_least_one_working_situation_is_sickness_and_household_sickness_is_no? |
|
|
|
@ -219,22 +218,18 @@ module Validations::SoftValidations |
|
|
|
private |
|
|
|
private |
|
|
|
|
|
|
|
|
|
|
|
def all_tenants_age_and_gender_information_completed? |
|
|
|
def all_tenants_age_and_gender_information_completed? |
|
|
|
return false if hhmemb.present? && hhmemb > 8 |
|
|
|
return false if hhmemb.present? && hhmemb > max_people_with_details |
|
|
|
return false unless all_tenants_gender_information_completed? |
|
|
|
return false unless all_tenants_gender_information_completed? |
|
|
|
|
|
|
|
|
|
|
|
person_count = hhmemb || 8 |
|
|
|
(1..people_with_details).all? do |n| |
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).all? do |n| |
|
|
|
|
|
|
|
public_send("age#{n}").present? && public_send("age#{n}_known").present? && public_send("age#{n}_known").zero? |
|
|
|
public_send("age#{n}").present? && public_send("age#{n}_known").present? && public_send("age#{n}_known").zero? |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def all_tenants_gender_information_completed? |
|
|
|
def all_tenants_gender_information_completed? |
|
|
|
return false if hhmemb.present? && hhmemb > 8 |
|
|
|
return false if hhmemb.present? && hhmemb > max_people_with_details |
|
|
|
|
|
|
|
|
|
|
|
person_count = hhmemb || 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).all? do |n| |
|
|
|
(1..people_with_details).all? do |n| |
|
|
|
tenant_gender_information_completed?(n) |
|
|
|
tenant_gender_information_completed?(n) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
@ -258,27 +253,21 @@ private |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def any_non_male_in_expected_pregnancy_age_range(min, max) |
|
|
|
def any_non_male_in_expected_pregnancy_age_range(min, max) |
|
|
|
person_count = hhmemb || 8 |
|
|
|
(1..people_with_details).any? do |n| |
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).any? do |n| |
|
|
|
|
|
|
|
person_in_expected_pregnancy_age_range(n, min, max) && person_is_non_male(n) |
|
|
|
person_in_expected_pregnancy_age_range(n, min, max) && person_is_non_male(n) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def non_males_in_the_household? |
|
|
|
def non_males_in_the_household? |
|
|
|
person_count = hhmemb || 8 |
|
|
|
(1..people_with_details).any? do |n| |
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).any? do |n| |
|
|
|
|
|
|
|
person_is_non_male(n) |
|
|
|
person_is_non_male(n) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def all_male_tenants_in_the_household? |
|
|
|
def all_male_tenants_in_the_household? |
|
|
|
return false if hhmemb.present? && hhmemb > 8 |
|
|
|
return false if hhmemb.present? && hhmemb > max_people_with_details |
|
|
|
|
|
|
|
|
|
|
|
person_count = hhmemb || 8 |
|
|
|
(1..people_with_details).all? do |n| |
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).all? do |n| |
|
|
|
|
|
|
|
person_is_male(n) |
|
|
|
person_is_male(n) |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
@ -344,11 +333,7 @@ private |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def at_least_one_person_working_situation_is_illness? |
|
|
|
def at_least_one_person_working_situation_is_illness? |
|
|
|
return if hhmemb.present? && hhmemb > 8 |
|
|
|
(1..people_with_details).any? { |n| public_send("ecstat#{n}") == 8 } |
|
|
|
|
|
|
|
|
|
|
|
person_count = hhmemb || 8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(1..person_count).any? { |n| public_send("ecstat#{n}") == 8 } |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def no_one_in_household_with_illness? |
|
|
|
def no_one_in_household_with_illness? |
|
|
|
|