diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 48fe5726d..6ac932b56 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -136,7 +136,7 @@ private content["conditional_route_to"].each do |route, conditions| if conditions.keys.all? { |x| case_log[x].present? } && conditions.all? { |k, v| v.include?(case_log[k]) } return "case_log_#{route}_path" - end + end end end form.next_page_redirect_path(previous_page) diff --git a/app/views/form/_select_question.html.erb b/app/views/form/_select_question.html.erb index 88c1a6058..6f41b6b35 100644 --- a/app/views/form/_select_question.html.erb +++ b/app/views/form/_select_question.html.erb @@ -1,8 +1,8 @@ <%= answers = question["answer_options"].map {|key, value| OpenStruct.new(id:key, name: value)} - f.govuk_collection_select :answer_id, + f.govuk_collection_select question_key, answers, - :id, + :name, :name, label: { text: question["header"]}, hint: { text: question["hint_text"] } diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 0808a1c54..6efc727f4 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -10,14 +10,14 @@ "label": "About this log", "pages": { "gdpr_acceptance": { - "header": "About this log", - "description": "About this log", + "header": "DLUHC Privacy Notice Acceptance", + "description": "", "questions": { "gdpr_acceptance": { - "check_answer_label": "", + "check_answer_label": "GDPR acceptance", "header": "Has the tenant or buyer seen the DLUHC privacy notice?", "hint_text": "", - "type": "select", + "type": "radio", "answer_options": { "0": "Yes", "1": "No" @@ -31,9 +31,12 @@ }, "gdpr_declined": { "header": "You cannot use this service", + "hint_text": "", "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.", "questions": { - } + + }, + "default_next_page" : "check_answers" }, "organisation_details": { "header": "About this log", @@ -74,14 +77,19 @@ "0": "Sale", "1": "Letting" } - } + }, + "conditional_route_to": { + "sale_completion_date": { "sale_or_letting": "Sale" }, + "tenant_same_property_renewal": { "sale_or_letting": "Letting" } + }, + "default_next_page" : "check_answers" } }, "tenant_same_property_renewal": { "header": "About this log", "description": "Is this a renewal to the same tenant in the same property?", "questions": { - "sale_or_letting": { + "tenant_same_property_renewal": { "check_answer_label": "", "header": "Is this a renewal to the same tenant in the same property?", "hint_text": "", @@ -97,7 +105,7 @@ "header": "About this log", "description": "", "questions": { - "sale_or_letting": { + "tenancy_start_date": { "check_answer_label": "When is the tenancy start date?", "header": "What is the tenancy start date?", "hint_text": "For example, 27 3 2007", @@ -121,6 +129,7 @@ "3": "Rent To Buy", "4": "London Living Rent", "5": "Other Intermediate Rent Product" + } }, "intermediate_rent_product_name": { "check_answer_label": "Enter the product name", @@ -138,6 +147,7 @@ "answer_options": { "0": "Supported Housing", "1": "General Needs" + } } } }, diff --git a/db/migrate/20211102100820_add_about_this_log_readable_columns.rb b/db/migrate/20211102100820_add_about_this_log_readable_columns.rb new file mode 100644 index 000000000..b451af20e --- /dev/null +++ b/db/migrate/20211102100820_add_about_this_log_readable_columns.rb @@ -0,0 +1,17 @@ +class AddAboutThisLogReadableColumns < ActiveRecord::Migration[6.1] + def change + change_table :case_logs, bulk: true do |t| + t.column :gdpr_acceptance, :string + t.column :gdpr_declined, :string + t.column :property_owner_organisation, :string + t.column :property_manager_organisation, :string + t.column :sale_or_letting, :string + t.column :tenant_same_property_renewal, :string + t.column :rent_type, :string + t.column :intermediate_rent_product_name, :string + t.column :needs_type, :string + t.column :sale_completion_date, :string + t.column :purchaser_code, :string + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 346f047c2..c29297c23 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_10_27_123535) do +ActiveRecord::Schema.define(version: 2021_11_02_100820) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -133,6 +133,17 @@ ActiveRecord::Schema.define(version: 2021_10_27_123535) do t.boolean "reasonable_preference_reason_do_not_know" t.datetime "discarded_at" t.string "other_tenancy_type" + t.string "gdpr_acceptance" + t.string "gdpr_declined" + t.string "property_owner_organisation" + t.string "property_manager_organisation" + t.string "sale_or_letting" + t.string "tenant_same_property_renewal" + t.string "rent_type" + t.string "intermediate_rent_product_name" + t.string "needs_type" + t.string "sale_completion_date" + t.string "purchaser_code" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end