Browse Source

Content and field name fixes

pull/147/head
Kat 4 years ago
parent
commit
1f2cdfcc75
  1. 2
      app/models/case_log.rb
  2. 4
      app/models/constants/case_log.rb
  3. 2
      app/models/validations/household_validations.rb
  4. 56
      config/forms/2021_2022.json
  5. 8
      db/migrate/20211203144855_add_postcode_known.rb
  6. 4
      db/schema.rb

2
app/models/case_log.rb

@ -113,6 +113,8 @@ class CaseLog < ApplicationRecord
enum renttype: RENT_TYPE, _suffix: true
enum needstype: NEEDS_TYPE, _suffix: true
enum lettype: LET_TYPE, _suffix: true
enum postcode_known: POLAR, _suffix: true
enum la_known: POLAR, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at renttype lettype].freeze
OPTIONAL_FIELDS = %w[do_you_know_the_postcode

4
app/models/constants/case_log.rb

@ -17,7 +17,7 @@ module Constants::CaseLog
BUILTYPE = {
"Purpose built" => 1,
"Conversion" => 2,
"Converted from previous residential or non-residential property" => 2,
}.freeze
ECSTAT = {
@ -169,7 +169,7 @@ module Constants::CaseLog
"First let of leased property" => 17,
"Tenant evicted due to arrears" => 10,
"Tenant evicted due to ASB or other reason" => 11,
"Tenant died (no succession)" => 5,
"Previous tenant passed away (no succession)" => 5,
"Tenant moved to other social housing provider" => 12,
"Tenant abandoned property" => 6,
"Tenant moved to private sector or other accommodation" => 8,

2
app/models/validations/household_validations.rb

@ -84,7 +84,7 @@ module Validations::HouseholdValidations
record.errors.add :unittype_gn, "A shared house must have 1 to 7 bedrooms"
end
if record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 3)
if record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 3) && record.beds.present?
record.errors.add :unittype_gn, "A shared house with less than two tenants must have 1 to 3 bedrooms"
end
end

56
config/forms/2021_2022.json

@ -1109,7 +1109,7 @@
"header": "",
"description": "",
"questions": {
"do_you_know_the_postcode": {
"postcode_known": {
"check_answer_label": "Do you know the property postcode?",
"header": "Do you know the postcode?",
"hint_text": "",
@ -1135,7 +1135,7 @@
"header": "",
"description": "",
"questions": {
"do_you_know_the_local_authority": {
"la_known": {
"check_answer_label": "Do you know what local authority the property is located in?",
"header": "Do you know what local authority the property is located in?",
"hint_text": "",
@ -1473,7 +1473,7 @@
}
}
},
"depends_on": { "do_you_know_the_local_authority": "Yes" }
"depends_on": { "la_known": "Yes" }
},
"why_dont_you_know_la": {
"header": "",
@ -1486,15 +1486,15 @@
"type": "text"
}
},
"depends_on": { "do_you_know_the_local_authority": "No" }
"depends_on": { "la_known": "No" }
},
"first_time_property_let_as_social_housing": {
"header": "",
"description": "",
"questions": {
"first_time_property_let_as_social_housing": {
"check_answer_label": "Which type was the property most recently let as?",
"header": "Is this property a relet?",
"check_answer_label": "Is this the first time the property has been let as social housing?",
"header": "Is this the first time the property has been let as social housing?",
"hint_text": "",
"type": "radio",
"answer_options": {
@ -1674,7 +1674,7 @@
"header": "",
"description": "",
"questions": {
"beds": {
"property_void_date": {
"check_answer_label": "void/renewal date",
"header": "What is the void or renewal date?",
"hint_text": "",
@ -1683,34 +1683,23 @@
},
"depends_on": { "rsnvac": "First let of newbuild property", "tenant_same_property_renewal": "No" }
},
"property_major_repairs": {
"new_build_handover_date": {
"header": "",
"description": "",
"questions": {
"majorrepairs": {
"check_answer_label": "Were major repairs carried out during the void period?",
"header": "Were any major repairs completed during the void period?",
"property_void_date": {
"check_answer_label": "What is the new build handover date?",
"header": "What is the new build handover date?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "No",
"1": "Yes"
},
"conditional_for": {
"mrcdate": ["Yes"]
},
"depends_on": { "tenant_same_property_renewal": "No" }
},
"mrcdate": {
"check_answer_label": "What was the major repairs completion date?",
"header": "What was the major repairs completion date?",
"hint_text": "For example, 27 3 2007",
"type": "date"
}
},
"depends_on": { "rsnvac": "First let of newbuild property" }
"depends_on": {
"tenant_same_property_renewal": "No",
"rsnvac": ["First let of conversion, rehabilitation or acquired property?", "First let of leased property"]
}
},
"new_build_handover_date": {
"property_major_repairs": {
"header": "",
"description": "",
"questions": {
@ -1725,13 +1714,16 @@
},
"conditional_for": {
"mrcdate": ["Yes"]
},
"depends_on": {
"tenant_same_property_renewal": "No",
"rsnvac": ["First let of conversion, rehabilitation or acquired property?", "First let of leased property"]
}
},
"mrcdate": {
"check_answer_label": "What was the major repairs completion date?",
"header": "What was the major repairs completion date?",
"hint_text": "For example, 27 3 2007",
"type": "date"
}
}
},
"depends_on": { "rsnvac": "First let of newbuild property", "tenant_same_property_renewal": "No"}
}
}
}

8
db/migrate/20211203144855_add_postcode_known.rb

@ -0,0 +1,8 @@
class AddPostcodeKnown < ActiveRecord::Migration[6.1]
def change
change_table :case_logs, bulk: true do |t|
t.column :postcode_known, :integer
t.column :la_known, :integer
end
end
end

4
db/schema.rb

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2021_12_02_124802) do
ActiveRecord::Schema.define(version: 2021_12_03_144855) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -169,6 +169,8 @@ ActiveRecord::Schema.define(version: 2021_12_02_124802) do
t.integer "renttype"
t.integer "needstype"
t.integer "lettype"
t.integer "postcode_known"
t.integer "la_known"
t.index ["discarded_at"], name: "index_case_logs_on_discarded_at"
t.index ["managing_organisation_id"], name: "index_case_logs_on_managing_organisation_id"
t.index ["owning_organisation_id"], name: "index_case_logs_on_owning_organisation_id"

Loading…
Cancel
Save