From 73906100dd93abc3d503a216358c0291b69800c2 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 9 Nov 2021 13:34:03 +0000 Subject: [PATCH] Update majorrepairs, national and reasonpref --- app/constants/db_enums.rb | 11 +++++++++++ app/models/case_log.rb | 3 ++- config/forms/2021_2022.json | 12 ++++++++---- db/migrate/20211108143649_change_reason_type.rb | 2 ++ db/schema.rb | 2 +- 5 files changed, 24 insertions(+), 6 deletions(-) diff --git a/app/constants/db_enums.rb b/app/constants/db_enums.rb index 19f7b443f..41486713b 100644 --- a/app/constants/db_enums.rb +++ b/app/constants/db_enums.rb @@ -90,6 +90,9 @@ module DbEnums "Bulgaria" => 14, "Romania" => 15, "Ireland" => 17, + "Slovakia" => 9, + "Slovenia" => 10, + "Croatia" => 16, "Other EU Economic Area (EEA country)" => 11, "Any other country" => 12, "Prefer not to say" => 13, @@ -154,6 +157,14 @@ module DbEnums } end + def self.polar_with_unknown + { + "No" => 2, + "Yes" => 1, + "Do not know" => 3, + } + end + def self.tenancy { "Fixed term – Secure" => 1, diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 62b657765..046008d68 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -100,10 +100,11 @@ class CaseLog < ApplicationRecord enum period: DbEnums.period, _suffix: true enum layear: DbEnums.latime, _suffix: true enum lawaitlist: DbEnums.latime, _suffix: true - enum reasonpref: DbEnums.polar2, _suffix: true + enum reasonpref: DbEnums.polar_with_unknown, _suffix: true enum reason: DbEnums.reason, _suffix: true enum la: DbEnums.la, _suffix: true enum prevloc: DbEnums.la, _suffix: true + enum majorrepairs: DbEnums.polar, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index f67f8dde9..9aa50caa5 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -285,9 +285,12 @@ "10": "Bulgaria", "11": "Romania", "12": "Ireland", - "13": "Other EU Economic Area (EEA country)", - "14": "Any other country", - "15": "Prefer not to say" + "13": "Slovakia", + "14":"Slovenia", + "15": "Croatia", + "16": "Other EU Economic Area (EEA country)", + "17": "Any other country", + "18": "Prefer not to say" } } } @@ -2237,7 +2240,8 @@ "type": "radio", "answer_options": { "0": "Yes", - "1": "No" + "1": "No", + "2": "Do not know" }, "conditional_for": { "reasonable_preference_reason": ["Yes"] diff --git a/db/migrate/20211108143649_change_reason_type.rb b/db/migrate/20211108143649_change_reason_type.rb index 04fe39575..da159550b 100644 --- a/db/migrate/20211108143649_change_reason_type.rb +++ b/db/migrate/20211108143649_change_reason_type.rb @@ -2,12 +2,14 @@ class ChangeReasonType < ActiveRecord::Migration[6.1] def up change_table :case_logs, bulk: true do |t| t.change :reason, "integer USING reason::integer" + t.change :majorrepairs, "integer USING majorrepairs::integer" end end def down change_table :case_logs, bulk: true do |t| t.change :reason, :string + t.change :majorrepairs, :string end end end diff --git a/db/schema.rb b/db/schema.rb index d24cc2bf5..dbc3ea5e3 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -82,7 +82,7 @@ ActiveRecord::Schema.define(version: 2021_11_08_143649) do t.string "property_building_type" t.integer "beds" t.string "property_void_date" - t.string "majorrepairs" + t.integer "majorrepairs" t.string "property_major_repairs_date" t.integer "offered" t.integer "wchair"