From 83ed5e85a976fdf2a9ddf6306ea75eeb93fc3a2f Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Mon, 29 Jan 2024 16:48:53 +0000 Subject: [PATCH] feat: add accessible_register option and hint text for 2024 --- .../lettings/questions/letting_allocation.rb | 28 +++++++++++++------ ...dd_accessible_register_to_lettings_logs.rb | 5 ++++ db/schema.rb | 3 +- 3 files changed, 26 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb diff --git a/app/models/form/lettings/questions/letting_allocation.rb b/app/models/form/lettings/questions/letting_allocation.rb index 18c0a3042..09fd82121 100644 --- a/app/models/form/lettings/questions/letting_allocation.rb +++ b/app/models/form/lettings/questions/letting_allocation.rb @@ -7,15 +7,27 @@ class Form::Lettings::Questions::LettingAllocation < ::Form::Question @type = "checkbox" @check_answers_card_number = 0 @hint_text = "Select all that apply." - @answer_options = ANSWER_OPTIONS @question_number = 84 end - ANSWER_OPTIONS = { - "cbl" => { "value" => "Choice-based lettings (CBL)" }, - "cap" => { "value" => "Common Allocation Policy (CAP)" }, - "chr" => { "value" => "Common housing register (CHR)" }, - "divider" => { "value" => true }, - "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, - }.freeze + def answer_options + if form.start_year_after_2024? + { + "cbl" => { "value" => "Choice-based lettings (CBL)", "hint" => "Where available vacant properties are advertised and applicants are able to bid for specific properties." }, + "cap" => { "value" => "Common Allocation Policy (CAP)", "hint" => "Where a common system agreed between a group of housing providers is used to determine applicant’s priority for housing." }, + "chr" => { "value" => "Common housing register (CHR)", "hint" => "Where a single waiting list is used by a group of housing providers to receive and process housing applications. Providers may use different approaches to determine priority." }, + "accessible_register" => { "value" => "Accessible housing register", "hint" => "Where the ‘access category’ or another descriptor of whether an available vacant property meets a range of access needs is displayed to applicants during the allocations process." }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }.freeze + else + { + "cbl" => { "value" => "Choice-based lettings (CBL)" }, + "cap" => { "value" => "Common Allocation Policy (CAP)" }, + "chr" => { "value" => "Common housing register (CHR)" }, + "divider" => { "value" => true }, + "letting_allocation_unknown" => { "value" => "None of these allocation systems" }, + }.freeze + end + end end diff --git a/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb b/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb new file mode 100644 index 000000000..623a95306 --- /dev/null +++ b/db/migrate/20240129161037_add_accessible_register_to_lettings_logs.rb @@ -0,0 +1,5 @@ +class AddAccessibleRegisterToLettingsLogs < ActiveRecord::Migration[7.0] + def change + add_column :lettings_logs, :accessible_register, :integer + end +end diff --git a/db/schema.rb b/db/schema.rb index e6f2de905..b7cde265b 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -305,6 +305,7 @@ ActiveRecord::Schema[7.0].define(version: 2024_01_30_084707) do t.integer "duplicate_set_id" t.integer "nationality_all" t.integer "nationality_all_group" + t.integer "accessible_register" t.index ["bulk_upload_id"], name: "index_lettings_logs_on_bulk_upload_id" t.index ["created_by_id"], name: "index_lettings_logs_on_created_by_id" t.index ["location_id"], name: "index_lettings_logs_on_location_id" @@ -466,8 +467,6 @@ ActiveRecord::Schema[7.0].define(version: 2024_01_30_084707) do t.string "reader_type", null: false t.bigint "reader_id" t.datetime "timestamp", precision: nil, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false t.index ["readable_type", "readable_id"], name: "index_read_marks_on_readable_type_and_readable_id" t.index ["reader_id", "reader_type", "readable_type", "readable_id"], name: "read_marks_reader_readable_index", unique: true t.index ["reader_type", "reader_id"], name: "index_read_marks_on_reader_type_and_reader_id"