From 5925ee568661fc3f099210458c83fb36cad9d7aa Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 11 Jan 2022 15:38:04 +0000 Subject: [PATCH] Add carehome questions and move the remaining rent questions to income and benefits section --- config/forms/2021_2022.json | 87 +++++++++++-------- ...20111140400_add_care_home_charge_fields.rb | 8 ++ db/schema.rb | 4 +- spec/factories/case_log.rb | 2 + spec/fixtures/complete_case_log.json | 4 +- 5 files changed, 66 insertions(+), 39 deletions(-) create mode 100644 db/migrate/20220111140400_add_care_home_charge_fields.rb diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index d21863a8b..c2004564e 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1988,35 +1988,37 @@ },{ "nocharge": null }] - } - } - }, - "rent": { - "label": "Rent", - "depends_on": [{ "about_this_log": "completed" }], - "pages": { - "rent": { + }, + "care_home": { "header": "", "description": "", "questions": { - "period": { - "check_answer_label": "Rent Period", - "header": "Which period are rent and other charges due?", + "is_carehome": { + "check_answer_label": "Is this accommodation a care home?", + "header": "Is this accommodation a care home?", "hint_text": "", "type": "radio", "answer_options": { - "0": "Weekly for 52 weeks", - "1": "Fortnightly", - "2": "Four-weekly", - "3": "Calendar monthly", - "4": "Weekly for 50 weeks", - "5": "Weekly for 49 weeks", - "6": "Weekly for 48 weeks", - "7": "Weekly for 47 weeks", - "8": "Weekly for 46 weeks", - "9": "Weekly for 53 weeks" + "1": "Yes", + "0": "No" + }, + "conditional_for": { + "chcharge": ["Yes"] } }, + "chcharge": { + "check_answer_label": "How much does the household pay every [PERIOD]?", + "header": "How much does the household pay every [PERIOD]?", + "hint_text": "", + "type": "numeric", + "width": 5 + } + } + }, + "rent": { + "header": "", + "description": "", + "questions": { "brent": { "check_answer_label": "Basic Rent", "header": "What is the basic rent?", @@ -2076,22 +2078,30 @@ "suffix": "every week", "readonly": true, "requires_js": true - }, + } + } + }, + "rent_shortfall":{ + "header": "", + "description": "", + "questions": { "hbrentshortfall": { - "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": "", - "type": "radio", - "answer_options": { - "0": "Yes", - "1": "No", - "divider": true, - "2": "Don’t know" - }, - "conditional_for": { - "tshortfall": ["Yes"] - } - }, + "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": "", + "type": "radio", + "answer_options": { + "0": "Yes", + "1": "No" + } + } + }, + "depends_on": [{"has_benefits": "yes"}] + }, + "rent_shortfall_amount":{ + "header": "", + "description": "", + "questions": { "tshortfall": { "check_answer_label": "Outstanding amount", "header": "What do you expect the amount to be?", @@ -2100,7 +2110,10 @@ "min": 0, "step": 1 } - } + }, + "depends_on": [{"has_benefits": "yes", + "hbrentshortfall": "Yes" + }] } } } diff --git a/db/migrate/20220111140400_add_care_home_charge_fields.rb b/db/migrate/20220111140400_add_care_home_charge_fields.rb new file mode 100644 index 000000000..cb2292913 --- /dev/null +++ b/db/migrate/20220111140400_add_care_home_charge_fields.rb @@ -0,0 +1,8 @@ +class AddCareHomeChargeFields < ActiveRecord::Migration[7.0] + def change + change_table :case_logs, bulk: true do |t| + t.column :is_carehome, :integer + t.column :chcharge, :decimal + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 7c68a7827..02790d5dd 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: 2022_01_10_161957) do +ActiveRecord::Schema.define(version: 2022_01_11_140400) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -180,6 +180,8 @@ ActiveRecord::Schema.define(version: 2022_01_10_161957) do t.integer "net_income_known" t.string "has_benefits" t.integer "nocharge" + t.integer "is_carehome" + t.decimal "chcharge" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id" t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id" diff --git a/spec/factories/case_log.rb b/spec/factories/case_log.rb index 2668914f9..ee1845122 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -149,6 +149,8 @@ FactoryBot.define do builtype { 1 } unitletas { 2 } nocharge { "No" } + is_carehome { "No" } + chcharge { 7 } end created_at { Time.zone.now } updated_at { Time.zone.now } diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 2f1585630..703ef4f9d 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -145,6 +145,8 @@ "void_or_renewal_date": "05/05/2020", "tenant_same_property_renewal": "Yes", "new_build_handover_date": "01/01/2019", - "nocharge": "No" + "nocharge": "No", + "is_carehome": "Yes", + "chcharge": "6" } }