diff --git a/app/models/form.rb b/app/models/form.rb index 34385af99..195a51f69 100644 --- a/app/models/form.rb +++ b/app/models/form.rb @@ -108,6 +108,7 @@ class Form end def page_routed_to?(page, case_log) + # binding.pry return true unless (conditions = page_dependencies(page)) conditions.all? do |question, value| diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index c5c60fa46..e12961300 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -81,7 +81,7 @@ "header": "About this log", "description": "Is this a renewal to the same tenant in the same property?", "questions": { - "tenant_same_property_renewal": { + "renewal": { "check_answer_label": "", "header": "Is this a renewal to the same tenant in the same property?", "hint_text": "", @@ -1120,7 +1120,7 @@ "questions": { "do_you_know_the_postcode": { "check_answer_label": "Do you know the property postcode?", - "header": "do_you_know_the_postcode?", + "header": "Do you know the postcode?", "hint_text": "", "type": "radio", "answer_options": { @@ -1128,7 +1128,7 @@ "1": "No" }, "conditional_for": { - "property_postcode": ["Yes"] + "postcode": ["Yes"] } }, "postcode": { @@ -1509,9 +1509,9 @@ "0": "Yes", "1": "No" } - }, - "depends_on": { "renewal": "Not Renewal"} - } + } + }, + "depends_on": { "renewal": "No"} }, "type_property_most_recently_let_as": { "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": { "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": { "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": { "header": "", @@ -1590,7 +1590,7 @@ "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": { "header": "", @@ -1606,7 +1606,7 @@ "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": { "header": "", @@ -1689,7 +1689,7 @@ "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": { "header": "", @@ -1707,7 +1707,7 @@ "conditional_for": { "mrcdate": ["Yes"] }, - "depends_on": { "renewal": "Not Renewal" } + "depends_on": { "renewal": "No" } }, "mrcdate": { "check_answer_label": "What was the major repairs completion date?", @@ -1735,7 +1735,7 @@ "mrcdate": ["Yes"] }, "depends_on": { - "renewal": "Not Renewal", + "renewal": "No", "rsnvac": "First let of conversion, rehabilitation or acquired property?", "rsnvac": "First let of leased property" } diff --git a/db/migrate/20211119142809_change_renewal.rb b/db/migrate/20211119142809_change_renewal.rb new file mode 100644 index 000000000..f8c244600 --- /dev/null +++ b/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 + + diff --git a/db/migrate/20211119154133_change_column_types.rb b/db/migrate/20211119154133_change_column_types.rb new file mode 100644 index 000000000..75c1c05b8 --- /dev/null +++ b/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 diff --git a/db/schema.rb b/db/schema.rb index 9b4b2a4bd..5ae2fff35 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: 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 enable_extension "plpgsql" @@ -128,7 +128,7 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.string "property_owner_organisation" t.string "property_manager_organisation" t.string "sale_or_letting" - t.string "tenant_same_property_renewal" + t.string "renewal" t.string "rent_type" t.string "intermediate_rent_product_name" t.string "needs_type" @@ -154,12 +154,12 @@ ActiveRecord::Schema.define(version: 2021_11_19_104835) do t.integer "incref" t.datetime "sale_completion_date" t.datetime "startdate" - t.integer "do_you_know_the_postcode" - t.integer "do_you_know_the_local_authority" + t.string "do_you_know_the_postcode" + t.string "do_you_know_the_local_authority" t.string "why_dont_you_know_la" - t.integer "first_time_property_let_as_social_housing" - t.integer "type_property_most_recently_let_as" - t.integer "builtype" + 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" end