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 Ecstat
include PreviousTenancy
include Homeless
default_scope -> { kept }
scope :not_completed, -> { where.not(status: "completed") }
@ -62,6 +63,7 @@ class CaseLog < ApplicationRecord
enum ecstat7: Ecstat.ecstat, _suffix: true
enum ecstat8: Ecstat.ecstat, _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

254
config/forms/2021_2022.json

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

2
db/schema.rb

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

Loading…
Cancel
Save