From 1a01921329a5b36df375e341ac016cad4502589e Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 22 Mar 2022 18:01:46 +0000 Subject: [PATCH] Reset all invalidated page questions --- app/models/case_log.rb | 2 +- config/forms/2021_2022.json | 42 ++++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index d8b726842..589727b72 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -296,7 +296,7 @@ private enabled = form.enabled_page_questions(self) answer_options = enabled.map(&:id).include?(question.id) ? enabled.find { |q| q.id == question.id }.answer_options : [] contains_selected_answer_option = answer_options.present? ? answer_options.key?(public_send(question.id).to_s) : false - if !contains_selected_answer_option && respond_to?(question.id.to_s) && (question.type == "radio" || question.type == "checkbox") + if !contains_selected_answer_option && respond_to?(question.id.to_s) public_send("#{question.id}=", nil) end end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 38b11a95e..e77c24cc0 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -5592,11 +5592,35 @@ }, "depends_on": [ { - "has_benefits": 1, + "hb": 1, "household_charge": 0 }, { - "has_benefits": 1, + "hb": 1, + "household_charge": null + }, + { + "hb": 6, + "household_charge": 0 + }, + { + "hb": 6, + "household_charge": null + }, + { + "hb": 7, + "household_charge": 0 + }, + { + "hb": 7, + "household_charge": null + }, + { + "hb": 8, + "household_charge": 0 + }, + { + "hb": 8, "household_charge": null } ] @@ -5619,7 +5643,19 @@ }, "depends_on": [ { - "has_benefits": 1, + "hb": 1, + "hbrentshortfall": 0 + }, + { + "hb": 6, + "hbrentshortfall": 0 + }, + { + "hb": 7, + "hbrentshortfall": 0 + }, + { + "hb": 8, "hbrentshortfall": 0 } ]