From 4c321148d308c2554fb9b086b02d34bcab8cd840 Mon Sep 17 00:00:00 2001 From: Kat Date: Mon, 24 Jan 2022 12:22:59 +0000 Subject: [PATCH] Add referral question/field --- app/models/case_log.rb | 1 + app/models/constants/case_log.rb | 16 +++++++++++ config/forms/2021_2022.json | 27 +++++++++++++++++++ .../20220124121642_add_referral_field.rb | 7 +++++ db/schema.rb | 19 ++++++------- 5 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 db/migrate/20220124121642_add_referral_field.rb diff --git a/app/models/case_log.rb b/app/models/case_log.rb index e689768ac..898dc44af 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -139,6 +139,7 @@ class CaseLog < ApplicationRecord enum household_charge: POLAR, _suffix: true enum is_carehome: POLAR, _suffix: true enum nocharge: POLAR, _suffix: true + enum referral: REFERRAL, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze OPTIONAL_FIELDS = %w[postcode_known la_known first_time_property_let_as_social_housing].freeze diff --git a/app/models/constants/case_log.rb b/app/models/constants/case_log.rb index ea816bb7f..0b7dc1b63 100644 --- a/app/models/constants/case_log.rb +++ b/app/models/constants/case_log.rb @@ -1096,6 +1096,22 @@ module Constants::CaseLog "Don’t know" => 4, }.freeze + REFERRAL = { + "Internal transfer" => 1, + "Tenant applied directly (no referral or nomination)" => 2, + "Private registered provider (PRP) lettings only - nominated by a local housing authority" => 3, + "Private registered provider (PRP) supported lettings only - referred by local authority housing department" => 4, + "Re-located through official housing mobility scheme" => 8, + "Other social landlord" => 10, + "Community learning disability team" => 9, + "Police, probation or prison" => 12, + "Youth offending team" => 13, + "Community mental health team" => 14, + "Health service" => 15, + "Voluntary agency" => 7, + "Other" => 16, + }.freeze + NON_TEMP_ACCOMMODATION = ["Tied housing or rented with job", "Supported housing", "Sheltered accomodation", diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 7800ea51a..d8990a2cd 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -3245,6 +3245,33 @@ } } } + }, + "referral": { + "header": "", + "description": "", + "questions": { + "referral": { + "check_answer_label": "Source of referral for letting", + "header": "What was the source of referral for this letting?", + "hint_text": "", + "type": "radio", + "answer_options": { + "0": "Internal transfer", + "1": "Tenant applied directly (no referral or nomination)", + "2": "Private registered provider (PRP) lettings only - nominated by a local housing authority", + "3": "Private registered provider (PRP) supported lettings only - referred by local authority housing department", + "4": "Re-located through official housing mobility scheme", + "5": "Other social landlord", + "6": "Community learning disability team", + "7": "Police, probation or prison", + "8": "Youth offending team", + "9": "Community mental health team", + "10": "Health service", + "11": "Voluntary agency", + "12": "Other" + } + } + } } } } diff --git a/db/migrate/20220124121642_add_referral_field.rb b/db/migrate/20220124121642_add_referral_field.rb new file mode 100644 index 000000000..c4fcec464 --- /dev/null +++ b/db/migrate/20220124121642_add_referral_field.rb @@ -0,0 +1,7 @@ +class AddReferralField < ActiveRecord::Migration[7.0] + def change + change_table :case_logs, bulk: true do |t| + t.column :referral, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 766b1cf55..52952738e 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_14_105351) do +ActiveRecord::Schema.define(version: 2022_01_24_121642) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -84,15 +84,9 @@ ActiveRecord::Schema.define(version: 2022_01_14_105351) do t.integer "beds" t.integer "offered" t.integer "wchair" - t.integer "earnings" t.integer "incfreq" t.integer "benefits" t.integer "period" - t.integer "brent" - t.integer "scharge" - t.integer "pscharge" - t.integer "supcharg" - t.integer "tcharge" t.integer "layear" t.integer "lawaitlist" t.string "property_postcode" @@ -143,7 +137,6 @@ ActiveRecord::Schema.define(version: 2022_01_14_105351) do t.string "prevloc" t.integer "hb" t.integer "hbrentshortfall" - t.integer "tshortfall" t.string "postcode" t.string "postcod2" t.string "ppostc1" @@ -181,9 +174,17 @@ ActiveRecord::Schema.define(version: 2022_01_14_105351) do t.string "has_benefits" t.integer "nocharge" t.integer "is_carehome" - t.decimal "chcharge" t.integer "letting_in_sheltered_accomodation" t.integer "household_charge" + t.integer "earnings" + t.integer "brent" + t.integer "scharge" + t.integer "pscharge" + t.integer "supcharg" + t.integer "tcharge" + t.integer "tshortfall" + t.integer "chcharge" + t.integer "referral" 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"