diff --git a/app/constants/ecstat.rb b/app/constants/ecstat.rb new file mode 100644 index 000000000..4e31317fc --- /dev/null +++ b/app/constants/ecstat.rb @@ -0,0 +1,19 @@ +module Ecstat + @@ecstat = { + "Part-time - Less than 30 hours" => 2, + "Full-time - 30 hours or more" => 1, + "In government training into work, such as New Deal" => 3, + "Jobseeker" => 4, + "Retired" => 5, + "Not seeking work" => 6, + "Full-time student" => 7, + "Unable to work because of long term sick or disability" => 8, + "Child under 16" => 100, + "Other" => 0, + "Prefer not to say" => 10, + } + + def self.ecstat + @@ecstat + end +end diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index 54923d657..f8bef385a 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -121,7 +121,7 @@ private end def authenticate - http_basic_authenticate_or_request_with ethnic: ENV["API_USER"], password: ENV["API_KEY"] + http_basic_authenticate_or_request_with name: ENV["API_USER"], password: ENV["API_KEY"] end def api_case_log_params diff --git a/app/models/case_log.rb b/app/models/case_log.rb index b63217970..3e5e9d0cb 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -39,6 +39,7 @@ class CaseLog < ApplicationRecord include SoftValidations include Ethnic include National + include Ecstat default_scope -> { kept } scope :not_completed, -> { where.not(status: "completed") } @@ -51,6 +52,14 @@ class CaseLog < ApplicationRecord enum ethnic: Ethnic.ethnic enum national: National.national, _suffix: true + enum ecstat1: Ecstat.ecstat, _suffix: true + enum ecstat2: Ecstat.ecstat, _suffix: true + enum ecstat3: Ecstat.ecstat, _suffix: true + enum ecstat4: Ecstat.ecstat, _suffix: true + enum ecstat5: Ecstat.ecstat, _suffix: true + enum ecstat6: Ecstat.ecstat, _suffix: true + enum ecstat7: Ecstat.ecstat, _suffix: true + enum ecstat8: Ecstat.ecstat, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 90e4b9574..343307b55 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -4,9 +4,9 @@ DLUHC CORE Data Collection <%= csrf_meta_tags %> <%= csp_meta_tag %> - <%= tag :meta, ethnic: 'viewport', content: 'width=device-width, initial-scale=1' %> + <%= tag :meta, name: 'viewport', content: 'width=device-width, initial-scale=1' %> <%= tag :meta, property: 'og:image', content: asset_pack_path('media/images/govuk-opengraph-image.png') %> - <%= tag :meta, ethnic: 'theme-color', content: '#0b0c0c' %> + <%= tag :meta, name: 'theme-color', content: '#0b0c0c' %> <%= favicon_link_tag asset_pack_path('media/images/favicon.ico') %> <%= favicon_link_tag asset_pack_path('media/images/govuk-mask-icon.svg'), rel: 'mask-icon', type: 'image/svg', color: "#0b0c0c" %> <%= favicon_link_tag asset_pack_path('media/images/govuk-apple-touch-icon.png'), rel: 'apple-touch-icon', type: 'image/png' %> diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 884234a3b..1917dcaaa 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -127,16 +127,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } } @@ -224,16 +224,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -276,16 +276,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -328,16 +328,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -380,16 +380,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -432,16 +432,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -484,16 +484,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } }, @@ -536,16 +536,16 @@ "hint_text": "", "type": "radio", "answer_options": { - "0": "Part-time - Less than 30 hours", + "2": "Part-time - Less than 30 hours", "1": "Full-time - 30 hours or more", - "2": "In government training into work, such as New Deal", - "3": "Jobseeker", - "4": "Retired", - "5": "Not seeking work", - "6": "Full-time student", - "7": "Unable to work because of long term sick or disability", - "8": "Child under 16", - "9": "Other", + "3": "In government training into work, such as New Deal", + "4": "Jobseeker", + "5": "Retired", + "6": "Not seeking work", + "7": "Full-time student", + "8": "Unable to work because of long term sick or disability", + "100": "Child under 16", + "0": "Other", "10": "Prefer not to say" } } diff --git a/db/migrate/20211103090530_change_field_types.rb b/db/migrate/20211103090530_change_field_types.rb index 33d308c8b..049f55ac8 100644 --- a/db/migrate/20211103090530_change_field_types.rb +++ b/db/migrate/20211103090530_change_field_types.rb @@ -3,6 +3,14 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1] change_table :case_logs, bulk: true do |t| t.change :ethnic, "integer USING ethnic::integer" t.change :national, "integer USING national::integer" + t.change :ecstat1, "integer USING ecstat1::integer" + t.change :ecstat2, "integer USING ecstat2::integer" + t.change :ecstat3, "integer USING ecstat3::integer" + t.change :ecstat4, "integer USING ecstat4::integer" + t.change :ecstat5, "integer USING ecstat5::integer" + t.change :ecstat6, "integer USING ecstat6::integer" + t.change :ecstat7, "integer USING ecstat7::integer" + t.change :ecstat8, "integer USING ecstat8::integer" end end @@ -10,6 +18,14 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1] change_table :case_logs, bulk: true do |t| t.change :ethnic, :string t.change :national, :string + t.change :ecstat1, :string + t.change :ecstat2, :string + t.change :ecstat3, :string + t.change :ecstat4, :string + t.change :ecstat5, :string + t.change :ecstat6, :string + t.change :ecstat7, :string + t.change :ecstat8, :string end end end diff --git a/db/schema.rb b/db/schema.rb index 3fcb1a8e9..64e806c4e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -23,39 +23,39 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do t.integer "age1" t.string "sex1" t.integer "ethnic" - t.string "national" + t.integer "national" t.string "prevten" t.string "armed_forces" - t.string "ecstat1" + t.integer "ecstat1" t.integer "hhmemb" t.string "relat2" t.integer "age2" t.string "sex2" - t.string "ecstat2" + t.integer "ecstat2" t.string "relat3" t.integer "age3" t.string "sex3" - t.string "ecstat3" + t.integer "ecstat3" t.string "relat4" t.integer "age4" t.string "sex4" - t.string "ecstat4" + t.integer "ecstat4" t.string "relat5" t.integer "age5" t.string "sex5" - t.string "ecstat5" + t.integer "ecstat5" t.string "relat6" t.integer "age6" t.string "sex6" - t.string "ecstat6" + t.integer "ecstat6" t.string "relat7" t.integer "age7" t.string "sex7" - t.string "ecstat7" + t.integer "ecstat7" t.string "relat8" t.integer "age8" t.string "sex8" - t.string "ecstat8" + t.integer "ecstat8" t.string "homeless" t.string "reason_for_leaving_last_settled_home" t.string "underoccupation_benefitcap" @@ -135,7 +135,7 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do t.boolean "override_net_income_validation" t.string "tenancyother" t.string "net_income_known" - t.index ["discarded_at"], ethnic: "index_case_logs_on_discarded_at" + t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end end