diff --git a/app/models/form/subsection.rb b/app/models/form/subsection.rb index 3f5827c92..f38ecc327 100644 --- a/app/models/form/subsection.rb +++ b/app/models/form/subsection.rb @@ -7,6 +7,7 @@ class Form::Subsection if hsh @label = hsh["label"] @depends_on = hsh["depends_on"] + @displayed_in_tasklist_from_json = hsh["displayed_in_tasklist"] @pages = hsh["pages"].map { |s_id, p| Form::Page.new(s_id, p, self) } end end @@ -48,7 +49,13 @@ class Form::Subsection end end - def displayed_in_tasklist?(_log) - true + def displayed_in_tasklist?(log) + return true unless @displayed_in_tasklist_from_json + + @displayed_in_tasklist_from_json.any? do |conditions| + conditions.all? do |method, expected_return_value| + log.send(method) == expected_return_value + end + end end end diff --git a/config/forms/2022_2023.json b/config/forms/2022_2023.json index eeed6c3c7..b8a88fd8e 100644 --- a/config/forms/2022_2023.json +++ b/config/forms/2022_2023.json @@ -939,7 +939,15 @@ } } } - } + }, + "displayed_in_tasklist": [ + { + "is_supported_housing?": false + }, + { + "is_renewal?": false + } + ] }, "tenancy_information": { "label": "Tenancy information",