From 1d077f21d985407bb24699b8baec55f782db984d Mon Sep 17 00:00:00 2001 From: samyou-softwire Date: Tue, 24 Feb 2026 11:14:37 +0000 Subject: [PATCH] CLDC-4239: Update age range for pregnancy soft validation for 2026 --- app/models/validations/soft_validations.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/models/validations/soft_validations.rb b/app/models/validations/soft_validations.rb index ea17d0601..0ff08afb1 100644 --- a/app/models/validations/soft_validations.rb +++ b/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