Browse Source

Change homeless field type

pull/79/head
Kat 4 years ago
parent
commit
1b698b6a10
  1. 11
      app/constants/homeless.rb
  2. 2
      app/models/case_log.rb
  3. 254
      config/forms/2021_2022.json
  4. 2
      db/migrate/20211103090530_change_field_types.rb
  5. 2
      db/schema.rb

11
app/constants/homeless.rb

@ -0,0 +1,11 @@
module Homeless
@@homeless = {
"Yes - assessed as homeless by a local authority and owed a homelessness duty. Including if threatened with homelessness within 56 days" => 11,
"Yes - other homelessness" => 7,
"No" => 1,
}
def self.homeless
@@homeless
end
end

2
app/models/case_log.rb

@ -41,6 +41,7 @@ class CaseLog < ApplicationRecord
include National include National
include Ecstat include Ecstat
include PreviousTenancy include PreviousTenancy
include Homeless
default_scope -> { kept } default_scope -> { kept }
scope :not_completed, -> { where.not(status: "completed") } scope :not_completed, -> { where.not(status: "completed") }
@ -62,6 +63,7 @@ class CaseLog < ApplicationRecord
enum ecstat7: Ecstat.ecstat, _suffix: true enum ecstat7: Ecstat.ecstat, _suffix: true
enum ecstat8: Ecstat.ecstat, _suffix: true enum ecstat8: Ecstat.ecstat, _suffix: true
enum prevten: PreviousTenancy.previous_tenancy, _suffix: true enum prevten: PreviousTenancy.previous_tenancy, _suffix: true
enum homeless: Homeless.homeless, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze

254
config/forms/2021_2022.json

@ -66,23 +66,23 @@
"answer_options": { "answer_options": {
"1": "White: English/Scottish/Welsh/Northern Irish/British", "1": "White: English/Scottish/Welsh/Northern Irish/British",
"2": "White: Irish", "2": "White: Irish",
"18": "White: Gypsy/Irish Traveller", "3": "White: Gypsy/Irish Traveller",
"3": "White: Other", "4": "White: Other",
"4": "Mixed: White & Black Caribbean", "5": "Mixed: White & Black Caribbean",
"5": "Mixed: White & Black African", "6": "Mixed: White & Black African",
"6": "Mixed: White & Asian", "7": "Mixed: White & Asian",
"7": "Mixed: Other", "8": "Mixed: Other",
"8": "Asian or Asian British: Indian", "9": "Asian or Asian British: Indian",
"9": "Asian or Asian British: Pakistani", "10": "Asian or Asian British: Pakistani",
"10": "Asian or Asian British: Bangladeshi", "11": "Asian or Asian British: Bangladeshi",
"15": "Asian or Asian British: Chinese", "12": "Asian or Asian British: Chinese",
"11": "Asian or Asian British: Other", "13": "Asian or Asian British: Other",
"12": "Black: Caribbean", "14": "Black: Caribbean",
"13": "Black: African", "15": "Black: African",
"14": "Black: Other", "16": "Black: Other",
"16": "Other Ethnic Group: Arab", "17": "Other Ethnic Group: Arab",
"19": "Other Ethnic Group: Other", "18": "Other Ethnic Group: Other",
"17": "Prefer not to say" "19": "Prefer not to say"
} }
} }
} }
@ -98,21 +98,21 @@
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"1": "UK national resident in UK", "1": "UK national resident in UK",
"100": "A current or former reserve in the UK Armed Forces (exc. National Service)", "2": "A current or former reserve in the UK Armed Forces (exc. National Service)",
"2": "UK national returning from residence overseas", "3": "UK national returning from residence overseas",
"3": "Czech Republic", "4": "Czech Republic",
"4": "Estonia", "5": "Estonia",
"5": "Hungary", "6": "Hungary",
"6": "Latvia", "7": "Latvia",
"7": "Lithuania", "8": "Lithuania",
"8": "Poland", "9": "Poland",
"9": "Slovakia", "10": "Slovakia",
"14": "Bulgaria", "11": "Bulgaria",
"15": "Romania", "12": "Romania",
"17": "Ireland", "13": "Ireland",
"11": "Other EU Economic Area (EEA country)", "14": "Other EU Economic Area (EEA country)",
"12": "Any other country", "15": "Any other country",
"13": "Prefer not to say" "16": "Prefer not to say"
} }
} }
} }
@ -127,16 +127,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
} }
@ -224,16 +224,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -276,16 +276,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -328,16 +328,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -380,16 +380,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -432,16 +432,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -484,16 +484,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
}, },
@ -536,16 +536,16 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"2": "Part-time - Less than 30 hours", "0": "Part-time - Less than 30 hours",
"1": "Full-time - 30 hours or more", "1": "Full-time - 30 hours or more",
"3": "In government training into work, such as New Deal", "2": "In government training into work, such as New Deal",
"4": "Jobseeker", "3": "Jobseeker",
"5": "Retired", "4": "Retired",
"6": "Not seeking work", "5": "Not seeking work",
"7": "Full-time student", "6": "Full-time student",
"8": "Unable to work because of long term sick or disability", "7": "Unable to work because of long term sick or disability",
"100": "Child under 16", "8": "Child under 16",
"0": "Other", "9": "Other",
"10": "Prefer not to say" "10": "Prefer not to say"
} }
} }
@ -565,29 +565,29 @@
"hint_text": "", "hint_text": "",
"type": "radio", "type": "radio",
"answer_options": { "answer_options": {
"26": "Owner occupation (private) ", "0": "Owner occupation (private) ",
"27": "Owner occupation (low cost home ownership)", "1": "Owner occupation (low cost home ownership)",
"3": "Private sector tenancy", "2": "Private sector tenancy",
"4": "Tied housing or rented with job", "3": "Tied housing or rented with job",
"5": "Supported housing", "4": "Supported housing",
"8": "Sheltered accomodation", "5": "Sheltered accomodation",
"9": "Residential care home", "6": "Residential care home",
"28": "Living with friends or family", "7": "Living with friends or family",
"21": "Refuge", "8": "Refuge",
"10": "Hospital", "9": "Hospital",
"29": "Prison / approved probation hostel", "10": "Prison / approved probation hostel",
"7": "Direct access hostel", "11": "Direct access hostel",
"14": "Bed & Breakfast", "12": "Bed & Breakfast",
"23": "Mobile home / caravan", "13": "Mobile home / caravan",
"18": "Any other temporary accommodation", "14": "Any other temporary accommodation",
"24": "Home Office Asylum Support", "15": "Home Office Asylum Support",
"13": "Children’s home / foster care", "16": "Children’s home / foster care",
"19": "Rough sleeping", "17": "Rough sleeping",
"25": "Other", "18": "Other",
"30": "Fixed term Local Authority General Needs tenancy", "19": "Fixed term Local Authority General Needs tenancy",
"31": "Lifetime Local Authority General Needs tenancy", "20": "Lifetime Local Authority General Needs tenancy",
"32": "Fixed term PRP General Needs tenancy", "21": "Fixed term PRP General Needs tenancy",
"33": "Lifetime PRP General Needs tenancy" "22": "Lifetime PRP General Needs tenancy"
} }
} }
} }

2
db/migrate/20211103090530_change_field_types.rb

@ -12,6 +12,7 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :ecstat7, "integer USING ecstat7::integer" t.change :ecstat7, "integer USING ecstat7::integer"
t.change :ecstat8, "integer USING ecstat8::integer" t.change :ecstat8, "integer USING ecstat8::integer"
t.change :prevten, "integer USING prevten::integer" t.change :prevten, "integer USING prevten::integer"
t.change :homeless, "integer USING homeless::integer"
end end
end end
@ -28,6 +29,7 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :ecstat7, :string t.change :ecstat7, :string
t.change :ecstat8, :string t.change :ecstat8, :string
t.change :prevten, :string t.change :prevten, :string
t.change :homeless, :string
end end
end end
end end

2
db/schema.rb

@ -56,7 +56,7 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.integer "age8" t.integer "age8"
t.string "sex8" t.string "sex8"
t.integer "ecstat8" t.integer "ecstat8"
t.string "homeless" t.integer "homeless"
t.string "reason_for_leaving_last_settled_home" t.string "reason_for_leaving_last_settled_home"
t.string "underoccupation_benefitcap" t.string "underoccupation_benefitcap"
t.string "leftreg" t.string "leftreg"

Loading…
Cancel
Save