Browse Source

add columns to about form

pull/78/head
magicmilo 3 years ago
parent
commit
df90dde031
  1. 4
      app/views/form/_select_question.html.erb
  2. 26
      config/forms/2021_2022.json
  3. 17
      db/migrate/20211102100820_add_about_this_log_readable_columns.rb
  4. 13
      db/schema.rb

4
app/views/form/_select_question.html.erb

@ -1,8 +1,8 @@
<%= answers = question["answer_options"].map {|key, value| OpenStruct.new(id:key, name: value)} <%= 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, answers,
:id, :name,
:name, :name,
label: { text: question["header"]}, label: { text: question["header"]},
hint: { text: question["hint_text"] } hint: { text: question["hint_text"] }

26
config/forms/2021_2022.json

@ -10,14 +10,14 @@
"label": "About this log", "label": "About this log",
"pages": { "pages": {
"gdpr_acceptance": { "gdpr_acceptance": {
"header": "About this log", "header": "DLUHC Privacy Notice Acceptance",
"description": "About this log", "description": "",
"questions": { "questions": {
"gdpr_acceptance": { "gdpr_acceptance": {
"check_answer_label": "", "check_answer_label": "GDPR acceptance",
"header": "Has the tenant or buyer seen the DLUHC privacy notice?", "header": "Has the tenant or buyer seen the DLUHC privacy notice?",
"hint_text": "", "hint_text": "",
"type": "select", "type": "radio",
"answer_options": { "answer_options": {
"0": "Yes", "0": "Yes",
"1": "No" "1": "No"
@ -31,9 +31,12 @@
}, },
"gdpr_declined": { "gdpr_declined": {
"header": "You cannot use this service", "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.", "description": "We cannot accept data about a tenant or buyer unless they’ve seen the DLUHC privacy notice.",
"questions": { "questions": {
}
},
"default_next_page" : "check_answers"
}, },
"organisation_details": { "organisation_details": {
"header": "About this log", "header": "About this log",
@ -74,14 +77,19 @@
"0": "Sale", "0": "Sale",
"1": "Letting" "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": { "tenant_same_property_renewal": {
"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": {
"sale_or_letting": { "tenant_same_property_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": "",
@ -97,7 +105,7 @@
"header": "About this log", "header": "About this log",
"description": "", "description": "",
"questions": { "questions": {
"sale_or_letting": { "tenancy_start_date": {
"check_answer_label": "When is the tenancy start date?", "check_answer_label": "When is the tenancy start date?",
"header": "What is the tenancy start date?", "header": "What is the tenancy start date?",
"hint_text": "For example, 27 3 2007", "hint_text": "For example, 27 3 2007",
@ -121,6 +129,7 @@
"3": "Rent To Buy", "3": "Rent To Buy",
"4": "London Living Rent", "4": "London Living Rent",
"5": "Other Intermediate Rent Product" "5": "Other Intermediate Rent Product"
}
}, },
"intermediate_rent_product_name": { "intermediate_rent_product_name": {
"check_answer_label": "Enter the product name", "check_answer_label": "Enter the product name",
@ -138,6 +147,7 @@
"answer_options": { "answer_options": {
"0": "Supported Housing", "0": "Supported Housing",
"1": "General Needs" "1": "General Needs"
}
} }
} }
}, },

17
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

13
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_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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" 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.boolean "reasonable_preference_reason_do_not_know"
t.datetime "discarded_at" t.datetime "discarded_at"
t.string "other_tenancy_type" 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" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
end end

Loading…
Cancel
Save