Browse Source

fixup! CLDC-4145: Derive is partner for under 16s

lint
CLDC-4145-dont-ask-partner-for-children
Samuel Young 3 days ago
parent
commit
d8b53bb2de
  1. 12
      app/models/derived_variables/lettings_log_variables.rb

12
app/models/derived_variables/lettings_log_variables.rb

@ -276,12 +276,12 @@ private
def clear_child_constraints_for_age_changes!
(2..8).each do |idx|
if public_send("age#{idx}_changed?")
self["ecstat#{idx}"] = nil if self["ecstat#{idx}"] == 9
# since the user can also input 'No' for relat there are cases when we don't want to clear this (changing age from 50 to 55 for example)
# note if age is changed from 10 to 15 we will clear it but the inference will set it back immediately after, see child_under_16_constraints!
self["relat#{idx}"] = nil if self["relat#{idx}"] == "X" && age_changed_from_below_16(idx) && form.start_year_2026_or_later?
end
next unless public_send("age#{idx}_changed?")
self["ecstat#{idx}"] = nil if self["ecstat#{idx}"] == 9
# since the user can also input 'No' for relat there are cases when we don't want to clear this (changing age from 50 to 55 for example)
# note if age is changed from 10 to 15 we will clear it but the inference will set it back immediately after, see child_under_16_constraints!
self["relat#{idx}"] = nil if self["relat#{idx}"] == "X" && age_changed_from_below_16(idx) && form.start_year_2026_or_later?
end
end

Loading…
Cancel
Save