Browse Source

CLDC-4239: Update age range for pregnancy soft validation for 2026

CLDC-4239-widen-age-range-for-pregnancy-soft-validation
samyou-softwire 3 weeks ago
parent
commit
1d077f21d9
  1. 9
      app/models/validations/soft_validations.rb

9
app/models/validations/soft_validations.rb

@ -76,7 +76,8 @@ module Validations::SoftValidations
end
def no_household_member_likely_to_be_pregnant?
all_male_tenants_in_a_pregnant_household? || non_males_in_pregnant_household_not_in_pregnancy_range?
# in this 2026 check we used a wider age range
all_male_tenants_in_a_pregnant_household? || non_males_in_pregnant_household_not_in_range?(13, 55)
end
def all_male_tenants_in_a_pregnant_household?
@ -84,7 +85,7 @@ module Validations::SoftValidations
end
def non_males_in_pregnant_household_not_in_pregnancy_range?
all_tenants_age_and_gender_information_completed? && non_males_in_the_household? && !any_non_male_in_expected_pregnancy_age_range(16, 50) && preg_occ == 1
non_males_in_pregnant_household_not_in_range?(16, 50)
end
TWO_YEARS_IN_DAYS = 730
@ -252,6 +253,10 @@ private
public_send("details_known_#{tenant_number}").zero?
end
def non_males_in_pregnant_household_not_in_range?(min, max)
all_tenants_age_and_gender_information_completed? && non_males_in_the_household? && !any_non_male_in_expected_pregnancy_age_range(min, max) && preg_occ == 1
end
def any_non_male_in_expected_pregnancy_age_range(min, max)
person_count = hhmemb || 8

Loading…
Cancel
Save