From e6d59173b4702dc32795d9dfe0e06428c8ba6016 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 12:10:20 +0000 Subject: [PATCH] add enums and switch to ints --- app/models/case_log.rb | 3 +++ config/forms/2021_2022.json | 12 ++++++------ .../20211119104835_add_property_info_fields.rb | 6 +++--- db/schema.rb | 6 +++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 32bc40739..fa1c189f9 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -110,6 +110,9 @@ class CaseLog < ApplicationRecord enum hbrentshortfall: DbEnums.polar_with_unknown, _suffix: true enum property_relet: DbEnums.polar, _suffix: true enum armedforces: DbEnums.armed_forces, _suffix: true + enum first_time_property_let_as_social_housing: DbEnums.polar, _suffix: true + enum do_you_know_the_postcode: DbEnums.polar, _suffix: true + enum do_you_know_the_local_authority: 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 578b9d1bc..b0897a69a 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1124,8 +1124,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" }, "conditional_for": { "postcode": ["Yes"] @@ -1149,8 +1149,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" } } } @@ -1506,8 +1506,8 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Yes", - "1": "No" + "0": "No", + "1": "Yes" } } }, diff --git a/db/migrate/20211119104835_add_property_info_fields.rb b/db/migrate/20211119104835_add_property_info_fields.rb index 98d8b4b71..1cab3c7e1 100644 --- a/db/migrate/20211119104835_add_property_info_fields.rb +++ b/db/migrate/20211119104835_add_property_info_fields.rb @@ -1,10 +1,10 @@ class AddPropertyInfoFields < ActiveRecord::Migration[6.1] def change change_table :case_logs, bulk: true do |t| - t.column :do_you_know_the_postcode, :string - t.column :do_you_know_the_local_authority, :string + t.column :do_you_know_the_postcode, :int + t.column :do_you_know_the_local_authority, :int + t.column :first_time_property_let_as_social_housing, :int t.column :why_dont_you_know_la, :string - t.column :first_time_property_let_as_social_housing, :string t.column :type_property_most_recently_let_as, :string t.column :builtype, :string t.rename :tenant_same_property_renewal, :renewal diff --git a/db/schema.rb b/db/schema.rb index d96ec5fe2..ecf56dd31 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -154,10 +154,10 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.string "do_you_know_the_postcode" - t.string "do_you_know_the_local_authority" + t.integer "do_you_know_the_postcode" + t.integer "do_you_know_the_local_authority" + t.integer "first_time_property_let_as_social_housing" t.string "why_dont_you_know_la" - t.string "first_time_property_let_as_social_housing" t.string "type_property_most_recently_let_as" t.string "builtype" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"