From 66ca7eb938ff5034cdab09e5124b3ac35b1b6f1e Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Tue, 5 Oct 2021 12:59:06 +0100 Subject: [PATCH] Make outstanding amount question conditional --- config/forms/2021_2022.json | 13 ++++++++++++- ...005115813_add_conditional_fields_to_case_logs.rb | 7 +++++++ db/schema.rb | 3 ++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20211005115813_add_conditional_fields_to_case_logs.rb diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index a5b3072ce..3a924c3e7 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1187,7 +1187,7 @@ "step": 1, "readonly": true }, - "outstanding_amount": { + "outstanding_rent_or_charges": { "check_answer_label": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?", "header": "After housing benefit and/or housing element of UC payment is received, will there be an outstanding amount for basic rent and/or benefit eligible charges?", "hint_text": "", @@ -1195,7 +1195,18 @@ "answer_options": { "0": "Yes", "1": "No" + }, + "conditional_for": { + "outstanding_amount": ["Yes"] } + }, + "outstanding_amount": { + "check_answer_label": "Outstanding amount", + "header": "What do you expect the amount to be?", + "hint_text": "If the amount is unknown you can estimate", + "type": "numeric", + "min": 0, + "step": 1 } } } diff --git a/db/migrate/20211005115813_add_conditional_fields_to_case_logs.rb b/db/migrate/20211005115813_add_conditional_fields_to_case_logs.rb new file mode 100644 index 000000000..c4c6a65fd --- /dev/null +++ b/db/migrate/20211005115813_add_conditional_fields_to_case_logs.rb @@ -0,0 +1,7 @@ +class AddConditionalFieldsToCaseLogs < ActiveRecord::Migration[6.1] + def change + change_table :case_logs, bulk: true do |t| + t.column :outstanding_rent_or_charges, :string + end + end +end diff --git a/db/schema.rb b/db/schema.rb index e3215a238..356db48e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2021_09_24_143031) do +ActiveRecord::Schema.define(version: 2021_10_05_115813) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -108,6 +108,7 @@ ActiveRecord::Schema.define(version: 2021_09_24_143031) do t.string "cbl_letting" t.string "chr_letting" t.string "cap_letting" + t.string "outstanding_rent_or_charges" end end