Browse Source

Change prevten field type

pull/79/head
Kat 4 years ago
parent
commit
a4ddce394e
  1. 31
      app/constants/previous_tenancy.rb
  2. 2
      app/models/case_log.rb
  3. 46
      config/forms/2021_2022.json
  4. 2
      db/migrate/20211103090530_change_field_types.rb
  5. 2
      db/schema.rb

31
app/constants/previous_tenancy.rb

@ -0,0 +1,31 @@
module PreviousTenancy
@@previous_tenancy = {
"Owner occupation (private) " => 26,
"Owner occupation (low cost home ownership)" => 27,
"Private sector tenancy" => 3,
"Tied housing or rented with job" => 4,
"Supported housing" => 5,
"Sheltered accomodation" => 8,
"Residential care home" => 9,
"Living with friends or family" => 28,
"Refuge" => 21,
"Hospital" => 10,
"Prison / approved probation hostel" => 29,
"Direct access hostel" => 7,
"Bed & Breakfast" => 14,
"Mobile home / caravan" => 23,
"Any other temporary accommodation" => 18,
"Home Office Asylum Support" => 24,
"Children’s home / foster care" => 13,
"Rough sleeping" => 19,
"Other" => 25,
"Fixed term Local Authority General Needs tenancy" => 30,
"Lifetime Local Authority General Needs tenancy" => 31,
"Fixed term PRP General Needs tenancy" => 32,
"Lifetime PRP General Needs tenancy" => 33,
}
def self.previous_tenancy
@@previous_tenancy
end
end

2
app/models/case_log.rb

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

46
config/forms/2021_2022.json

@ -565,29 +565,29 @@
"hint_text": "",
"type": "radio",
"answer_options": {
"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"
"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"
}
}
}

2
db/migrate/20211103090530_change_field_types.rb

@ -11,6 +11,7 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :ecstat6, "integer USING ecstat6::integer"
t.change :ecstat7, "integer USING ecstat7::integer"
t.change :ecstat8, "integer USING ecstat8::integer"
t.change :prevten, "integer USING prevten::integer"
end
end
@ -26,6 +27,7 @@ class ChangeFieldTypes < ActiveRecord::Migration[6.1]
t.change :ecstat6, :string
t.change :ecstat7, :string
t.change :ecstat8, :string
t.change :prevten, :string
end
end
end

2
db/schema.rb

@ -24,7 +24,7 @@ ActiveRecord::Schema.define(version: 2021_11_03_090530) do
t.string "sex1"
t.integer "ethnic"
t.integer "national"
t.string "prevten"
t.integer "prevten"
t.string "armed_forces"
t.integer "ecstat1"
t.integer "hhmemb"

Loading…
Cancel
Save