Browse Source

change column types

pull/95/head
magicmilo 3 years ago
parent
commit
c7a63e46b8
  1. 1
      app/models/form.rb
  2. 28
      config/forms/2021_2022.json
  3. 7
      db/migrate/20211119142809_change_renewal.rb
  4. 21
      db/migrate/20211119154133_change_column_types.rb
  5. 14
      db/schema.rb

1
app/models/form.rb

@ -108,6 +108,7 @@ class Form
end end
def page_routed_to?(page, case_log) def page_routed_to?(page, case_log)
# binding.pry
return true unless (conditions = page_dependencies(page)) return true unless (conditions = page_dependencies(page))
conditions.all? do |question, value| conditions.all? do |question, value|

28
config/forms/2021_2022.json

@ -81,7 +81,7 @@
"header": "About this log", "header": "About this log",
"description": "Is this a renewal to the same tenant in the same property?", "description": "Is this a renewal to the same tenant in the same property?",
"questions": { "questions": {
"tenant_same_property_renewal": { "renewal": {
"check_answer_label": "", "check_answer_label": "",
"header": "Is this a renewal to the same tenant in the same property?", "header": "Is this a renewal to the same tenant in the same property?",
"hint_text": "", "hint_text": "",
@ -1120,7 +1120,7 @@
"questions": { "questions": {
"do_you_know_the_postcode": { "do_you_know_the_postcode": {
"check_answer_label": "Do you know the property postcode?", "check_answer_label": "Do you know the property postcode?",
"header": "do_you_know_the_postcode?", "header": "Do you know the postcode?",
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
@ -1128,7 +1128,7 @@
"1": "No" "1": "No"
}, },
"conditional_for": { "conditional_for": {
"property_postcode": ["Yes"] "postcode": ["Yes"]
} }
}, },
"postcode": { "postcode": {
@ -1509,9 +1509,9 @@
"0": "Yes", "0": "Yes",
"1": "No" "1": "No"
} }
}, }
"depends_on": { "renewal": "Not Renewal"} },
} "depends_on": { "renewal": "No"}
}, },
"type_property_most_recently_let_as": { "type_property_most_recently_let_as": {
"header": "", "header": "",
@ -1530,7 +1530,7 @@
} }
} }
}, },
"depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" }
}, },
"property_vacancy_reason_not_first_let": { "property_vacancy_reason_not_first_let": {
"header": "", "header": "",
@ -1556,7 +1556,7 @@
} }
} }
}, },
"depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" }
}, },
"property_vacancy_reason_first_let": { "property_vacancy_reason_first_let": {
"header": "", "header": "",
@ -1574,7 +1574,7 @@
} }
} }
}, },
"depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" }
}, },
"property_number_of_times_relet_not_social_let": { "property_number_of_times_relet_not_social_let": {
"header": "", "header": "",
@ -1590,7 +1590,7 @@
"step": 1 "step": 1
} }
}, },
"depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "Not Renewal" } "depends_on": { "first_time_property_let_as_social_housing": "No", "renewal": "No" }
}, },
"property_number_of_times_relet_social_let": { "property_number_of_times_relet_social_let": {
"header": "", "header": "",
@ -1606,7 +1606,7 @@
"step": 1 "step": 1
} }
}, },
"depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "Not Renewal" } "depends_on": { "first_time_property_let_as_social_housing": "Yes", "renewal": "No" }
}, },
"property_unit_type": { "property_unit_type": {
"header": "", "header": "",
@ -1689,7 +1689,7 @@
"type": "date" "type": "date"
} }
}, },
"depends_on": { "rsnvac": "First let of newbuild property", "renewal": "Not Renewal" } "depends_on": { "rsnvac": "First let of newbuild property", "renewal": "No" }
}, },
"property_major_repairs": { "property_major_repairs": {
"header": "", "header": "",
@ -1707,7 +1707,7 @@
"conditional_for": { "conditional_for": {
"mrcdate": ["Yes"] "mrcdate": ["Yes"]
}, },
"depends_on": { "renewal": "Not Renewal" } "depends_on": { "renewal": "No" }
}, },
"mrcdate": { "mrcdate": {
"check_answer_label": "What was the major repairs completion date?", "check_answer_label": "What was the major repairs completion date?",
@ -1735,7 +1735,7 @@
"mrcdate": ["Yes"] "mrcdate": ["Yes"]
}, },
"depends_on": { "depends_on": {
"renewal": "Not Renewal", "renewal": "No",
"rsnvac": "First let of conversion, rehabilitation or acquired property?", "rsnvac": "First let of conversion, rehabilitation or acquired property?",
"rsnvac": "First let of leased property" "rsnvac": "First let of leased property"
} }

7
db/migrate/20211119142809_change_renewal.rb

@ -0,0 +1,7 @@
class ChangeRenewal < ActiveRecord::Migration[6.1]
def change
rename_column :case_logs, :tenant_same_property_renewal, :renewal
end
end

21
db/migrate/20211119154133_change_column_types.rb

@ -0,0 +1,21 @@
class ChangeColumnTypes < ActiveRecord::Migration[6.1]
def up
change_table :case_logs, bulk: true do |t|
t.change :first_time_property_let_as_social_housing, :string
t.change :type_property_most_recently_let_as, :string
t.change :builtype, :string
t.change :do_you_know_the_local_authority, :string
t.change :do_you_know_the_postcode, :string
end
end
def down
change_table :case_logs, bulk: true do |t|
t.change :first_time_property_let_as_social_housing, :int
t.change :type_property_most_recently_let_as, :int
t.change :builtype, :int
t.change :do_you_know_the_local_authority, :int
t.change :do_you_know_the_postcode, :int
end
end
end

14
db/schema.rb

@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_11_19_104835) do ActiveRecord::Schema.define(version: 2021_11_19_154133) do
# These are extensions that must be enabled in order to support this database # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -128,7 +128,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do
t.string "property_owner_organisation" t.string "property_owner_organisation"
t.string "property_manager_organisation" t.string "property_manager_organisation"
t.string "sale_or_letting" t.string "sale_or_letting"
t.string "tenant_same_property_renewal" t.string "renewal"
t.string "rent_type" t.string "rent_type"
t.string "intermediate_rent_product_name" t.string "intermediate_rent_product_name"
t.string "needs_type" t.string "needs_type"
@ -154,12 +154,12 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do
t.integer "incref" t.integer "incref"
t.datetime "sale_completion_date" t.datetime "sale_completion_date"
t.datetime "startdate" t.datetime "startdate"
t.integer "do_you_know_the_postcode" t.string "do_you_know_the_postcode"
t.integer "do_you_know_the_local_authority" t.string "do_you_know_the_local_authority"
t.string "why_dont_you_know_la" t.string "why_dont_you_know_la"
t.integer "first_time_property_let_as_social_housing" t.string "first_time_property_let_as_social_housing"
t.integer "type_property_most_recently_let_as" t.string "type_property_most_recently_let_as"
t.integer "builtype" t.string "builtype"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
end end

Loading…
Cancel
Save