From feccf8d8d58caae0618792ffaa356bfc73fb16ac Mon Sep 17 00:00:00 2001 From: Dushan <47317567+dushan-madetech@users.noreply.github.com> Date: Thu, 13 Jan 2022 16:20:50 +0000 Subject: [PATCH] Cldc 924 tenancy information burden reduction 2021 2022 form (#216) * make changes for 2021-2022 form * add more changes to 2021-2022 form * execute migration * more form changes * Add rent period question and check multiple condition sets for depends_on cherry picked from CLDC-632-income-and-benefits-section branch * update form json * form and enum changes * create new constants for enums * Update config/forms/2021_2022.json Co-authored-by: Paul Robert Lloyd * form alphabetising and lint fixes * add divider * Update app/models/constants/case_log.rb Co-authored-by: Paul Robert Lloyd * Update config/forms/2021_2022.json Co-authored-by: Paul Robert Lloyd Co-authored-by: Kat Co-authored-by: Paul Robert Lloyd --- app/models/case_log.rb | 3 +- app/models/constants/case_log.rb | 13 ++ config/forms/2021_2022.json | 120 ++++++++++++++---- ...letting_in_sheltered_accomodation_field.rb | 7 + db/schema.rb | 3 +- spec/factories/case_log.rb | 1 + spec/fixtures/complete_case_log.json | 3 +- 7 files changed, 121 insertions(+), 29 deletions(-) create mode 100644 db/migrate/20220112124047_add_letting_in_sheltered_accomodation_field.rb diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 5e8380e7a..7f5527fc5 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -47,7 +47,8 @@ class CaseLog < ApplicationRecord scope :for_organisation, ->(org) { where(owning_organisation: org).or(where(managing_organisation: org)) } - enum status: { "not_started" => 0, "in_progress" => 1, "completed" => 2 } + enum status: STATUS + enum letting_in_sheltered_accomodation: SHELTERED_ACCOMODATION enum ethnic: ETHNIC enum national: NATIONAL, _suffix: true enum ecstat1: ECSTAT, _suffix: true diff --git a/app/models/constants/case_log.rb b/app/models/constants/case_log.rb index bf9fc55fa..633d8e15c 100644 --- a/app/models/constants/case_log.rb +++ b/app/models/constants/case_log.rb @@ -1081,4 +1081,17 @@ module Constants::CaseLog "Universal Credit with housing element (excluding housing benefit)", "Universal Credit (without housing element)", "Housing benefit and Universal Credit (without housing element)"].freeze + + STATUS = { + "not_started" => 0, + "in_progress" => 1, + "completed" => 2, + }.freeze + + SHELTERED_ACCOMODATION = { + "Yes - sheltered housing" => 1, + "Yes - extra care housing" => 2, + "No" => 3, + "Don’t know" => 4, + }.freeze end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 5b1659927..b31bdf562 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1070,36 +1070,48 @@ } } }, - "fixed_term_tenancy": { + "tenancy_type": { "header": "", "description": "", "questions": { - "tenancylength": { - "check_answer_label": "If the main tenancy is a fixed term tenancy, please provide the length of the fixed term (to the nearest year) excluding any starter/introductory period", - "header": "If fixed-term, what is the length of the fixed-term tenancy after any starter period?", - "hint_text": "To the nearest year", - "type": "numeric", - "min": 0, - "max": 150, - "step": 1, - "width": 4 + "tenancy": { + "check_answer_label": "Type of main tenancy", + "header": "What is the type of tenancy?", + "hint_text": "", + "type": "radio", + "answer_options": { + "0": "Assured", + "1": "Assured Shorthold", + "2": "Licence agreement (almshouses only)", + "3": "Secure (including flexible)", + "4": "Other" + }, + "conditional_for": { + "tenancyother": ["Other"] + } + }, + "tenancyother": { + "header": "Please state the tenancy type", + "hint_text": "", + "type": "text" } - } + }, + "depends_on": [{ "startertenancy": "No" }] }, - "tenancy_type": { + "tenancy_type_starter_text": { "header": "", "description": "", "questions": { "tenancy": { - "check_answer_label": "Type of main tenancy (after any starter/introductory period)", + "check_answer_label": "Type of main tenancy after the starter period has ended?", "header": "What is the type of tenancy after the starter period has ended?", - "hint_text": "", + "hint_text": "This is also known as an ‘introductory period’.", "type": "radio", "answer_options": { - "0": "Secure (including flexible)", - "1": "Assured", - "2": "Assured Shorthold", - "3": "Licence agreement (almshouses only)", + "0": "Assured", + "1": "Assured Shorthold", + "2": "Licence agreement (almshouses only)", + "3": "Secure (including flexible)", "4": "Other" }, "conditional_for": { @@ -1111,23 +1123,44 @@ "hint_text": "", "type": "text" } - } + }, + "depends_on": [{ "startertenancy": "Yes" }] }, - "letting_provider": { + "fixed_term_tenancy": { "header": "", "description": "", "questions": { - "landlord": { - "check_answer_label": "Provider", - "header": "Who is the letting provider?", + "tenancylength": { + "check_answer_label": "Length of fixed-term tenancy", + "header": "What is the length of the fixed-term tenancy to the nearest year?", + "hint_text": "", + "type": "numeric", + "min": 0, + "max": 150, + "step": 1 + } + }, + "depends_on": [{ "tenancy": "Secure (including flexible)" }, {"tenancy": "Assured Shorthold" }] + }, + "letting_in_sheltered_accomodation": { + "header": "", + "description": "", + "questions": { + "letting_in_sheltered_accomodation": { + "check_answer_label": "Is this letting in sheltered accommodation?", + "header": "Is this letting in sheltered accommodation?", "hint_text": "", "type": "radio", "answer_options": { - "0": "This landlord", - "1": "Another registered provider - includes housing association or local authority" + "0": "Yes - sheltered housing", + "1": "Yes - extra care housing", + "2": "No", + "divider": true, + "3": "Don’t know" } } - } + }, + "depends_on": [{ "needstype": "Supported housing" }] } } }, @@ -1962,6 +1995,41 @@ "depends_on": [{ "needstype": "Supported housing" }] }, "rent_period": { + "header": "", + "description": "", + "questions": { + "period": { + "check_answer_label": "Rent Period", + "header": "How often does the household pay rent and other charges?", + "hint_text": "", + "type": "radio", + "answer_options": { + "0": "Calendar monthly", + "1": "Fortnightly", + "2": "Four-weekly", + "3": "Weekly for 46 weeks", + "4": "Weekly for 47 weeks", + "5": "Weekly for 48 weeks", + "6": "Weekly for 49 weeks", + "7": "Weekly for 50 weeks", + "8": "Weekly for 52 weeks", + "9": "Weekly for 53 weeks" + } + } + }, + "depends_on" : [{ + "nocharge": "Yes" + },{ + "nocharge": null + }] + } + } + }, + "rent": { + "label": "Rent", + "depends_on": [{ "about_this_log": "completed" }], + "pages": { + "rent": { "header": "", "description": "", "questions": { diff --git a/db/migrate/20220112124047_add_letting_in_sheltered_accomodation_field.rb b/db/migrate/20220112124047_add_letting_in_sheltered_accomodation_field.rb new file mode 100644 index 000000000..3b2fd7ecf --- /dev/null +++ b/db/migrate/20220112124047_add_letting_in_sheltered_accomodation_field.rb @@ -0,0 +1,7 @@ +class AddLettingInShelteredAccomodationField < ActiveRecord::Migration[7.0] + def change + change_table :case_logs, bulk: true do |t| + t.column :letting_in_sheltered_accomodation, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 2a89c3629..0f352d747 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -162,9 +162,9 @@ ActiveRecord::Schema.define(version: 2022_01_12_151048) do t.string "why_dont_you_know_la" t.integer "unitletas" t.integer "builtype" + t.datetime "property_void_date" t.bigint "owning_organisation_id" t.bigint "managing_organisation_id" - t.datetime "property_void_date" t.integer "renttype" t.integer "needstype" t.integer "lettype" @@ -183,6 +183,7 @@ ActiveRecord::Schema.define(version: 2022_01_12_151048) do t.integer "is_carehome" t.decimal "chcharge" t.integer "household_charge" + t.integer "letting_in_sheltered_accomodation" 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 8f00d862e..fe0074824 100644 --- a/spec/factories/case_log.rb +++ b/spec/factories/case_log.rb @@ -152,6 +152,7 @@ FactoryBot.define do has_benefits { "Yes" } is_carehome { "No" } chcharge { 7 } + letting_in_sheltered_accomodation { "No" } 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 fc31d6330..e5cd83d04 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -148,6 +148,7 @@ "has_benefits": "Yes", "household_charge": "Yes", "is_carehome": "Yes", - "chcharge": "6" + "chcharge": "6", + "letting_in_sheltered_accomodation": "No" } }