Browse Source

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 <paulrobertlloyd@users.noreply.github.com>

* form alphabetising and lint fixes

* add divider

* Update app/models/constants/case_log.rb

Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>

* Update config/forms/2021_2022.json

Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>

Co-authored-by: Kat <katrina@madetech.com>
Co-authored-by: Paul Robert Lloyd <paulrobertlloyd@users.noreply.github.com>
pull/219/head
Dushan 3 years ago committed by GitHub
parent
commit
feccf8d8d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      app/models/case_log.rb
  2. 13
      app/models/constants/case_log.rb
  3. 120
      config/forms/2021_2022.json
  4. 7
      db/migrate/20220112124047_add_letting_in_sheltered_accomodation_field.rb
  5. 3
      db/schema.rb
  6. 1
      spec/factories/case_log.rb
  7. 3
      spec/fixtures/complete_case_log.json

3
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)) } 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 ethnic: ETHNIC
enum national: NATIONAL, _suffix: true enum national: NATIONAL, _suffix: true
enum ecstat1: ECSTAT, _suffix: true enum ecstat1: ECSTAT, _suffix: true

13
app/models/constants/case_log.rb

@ -1081,4 +1081,17 @@ module Constants::CaseLog
"Universal Credit with housing element (excluding housing benefit)", "Universal Credit with housing element (excluding housing benefit)",
"Universal Credit (without housing element)", "Universal Credit (without housing element)",
"Housing benefit and Universal Credit (without housing element)"].freeze "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 end

120
config/forms/2021_2022.json

@ -1070,36 +1070,48 @@
} }
} }
}, },
"fixed_term_tenancy": { "tenancy_type": {
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"tenancylength": { "tenancy": {
"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", "check_answer_label": "Type of main tenancy",
"header": "If fixed-term, what is the length of the fixed-term tenancy after any starter period?", "header": "What is the type of tenancy?",
"hint_text": "To the nearest year", "hint_text": "",
"type": "numeric", "type": "radio",
"min": 0, "answer_options": {
"max": 150, "0": "Assured",
"step": 1, "1": "Assured Shorthold",
"width": 4 "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": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"tenancy": { "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?", "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", "type": "radio",
"answer_options": { "answer_options": {
"0": "Secure (including flexible)", "0": "Assured",
"1": "Assured", "1": "Assured Shorthold",
"2": "Assured Shorthold", "2": "Licence agreement (almshouses only)",
"3": "Licence agreement (almshouses only)", "3": "Secure (including flexible)",
"4": "Other" "4": "Other"
}, },
"conditional_for": { "conditional_for": {
@ -1111,23 +1123,44 @@
"hint_text": "", "hint_text": "",
"type": "text" "type": "text"
} }
} },
"depends_on": [{ "startertenancy": "Yes" }]
}, },
"letting_provider": { "fixed_term_tenancy": {
"header": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {
"landlord": { "tenancylength": {
"check_answer_label": "Provider", "check_answer_label": "Length of fixed-term tenancy",
"header": "Who is the letting provider?", "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": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"0": "This landlord", "0": "Yes - sheltered housing",
"1": "Another registered provider - includes housing association or local authority" "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" }] "depends_on": [{ "needstype": "Supported housing" }]
}, },
"rent_period": { "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": "", "header": "",
"description": "", "description": "",
"questions": { "questions": {

7
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

3
db/schema.rb

@ -162,9 +162,9 @@ ActiveRecord::Schema.define(version: 2022_01_12_151048) do
t.string "why_dont_you_know_la" t.string "why_dont_you_know_la"
t.integer "unitletas" t.integer "unitletas"
t.integer "builtype" t.integer "builtype"
t.datetime "property_void_date"
t.bigint "owning_organisation_id" t.bigint "owning_organisation_id"
t.bigint "managing_organisation_id" t.bigint "managing_organisation_id"
t.datetime "property_void_date"
t.integer "renttype" t.integer "renttype"
t.integer "needstype" t.integer "needstype"
t.integer "lettype" t.integer "lettype"
@ -183,6 +183,7 @@ ActiveRecord::Schema.define(version: 2022_01_12_151048) do
t.integer "is_carehome" t.integer "is_carehome"
t.decimal "chcharge" t.decimal "chcharge"
t.integer "household_charge" t.integer "household_charge"
t.integer "letting_in_sheltered_accomodation"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" 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 ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id" t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"

1
spec/factories/case_log.rb

@ -152,6 +152,7 @@ FactoryBot.define do
has_benefits { "Yes" } has_benefits { "Yes" }
is_carehome { "No" } is_carehome { "No" }
chcharge { 7 } chcharge { 7 }
letting_in_sheltered_accomodation { "No" }
end end
created_at { Time.zone.now } created_at { Time.zone.now }
updated_at { Time.zone.now } updated_at { Time.zone.now }

3
spec/fixtures/complete_case_log.json vendored

@ -148,6 +148,7 @@
"has_benefits": "Yes", "has_benefits": "Yes",
"household_charge": "Yes", "household_charge": "Yes",
"is_carehome": "Yes", "is_carehome": "Yes",
"chcharge": "6" "chcharge": "6",
"letting_in_sheltered_accomodation": "No"
} }
} }

Loading…
Cancel
Save