Browse Source

Add nocharge field

pull/213/head
Kat 4 years ago
parent
commit
f7f47ec8e6
  1. 1
      app/models/case_log.rb
  2. 5
      app/models/constants/case_log.rb
  3. 17
      config/forms/2021_2022.json
  4. 7
      db/migrate/20220110161957_add_nocharge_field.rb
  5. 3
      db/schema.rb
  6. 1
      spec/factories/case_log.rb
  7. 3
      spec/fixtures/complete_case_log.json

1
app/models/case_log.rb

@ -135,6 +135,7 @@ class CaseLog < ApplicationRecord
enum postcode_known: POLAR, _suffix: true
enum la_known: POLAR, _suffix: true
enum net_income_known: NET_INCOME_KNOWN, _suffix: true
enum nocharge: POLAR3, _suffix: true
AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze
OPTIONAL_FIELDS = %w[postcode_known la_known first_time_property_let_as_social_housing].freeze

5
app/models/constants/case_log.rb

@ -144,6 +144,11 @@ module Constants::CaseLog
"Yes" => 1,
}.freeze
POLAR3 = {
"No" => 1,
"Yes" => 0,
}.freeze
POLAR_WITH_UNKNOWN = {
"No" => 2,
"Yes" => 1,

17
config/forms/2021_2022.json

@ -1949,6 +1949,23 @@
}
}
}
},
"rent_or_other_charges": {
"header": "",
"description": "",
"questions": {
"nocharge": {
"check_answer_label": "Does the household pay rent or other charges for the accommodation?",
"header": "Does the household pay rent or other charges for the accommodation?",
"hint_text": "",
"type": "radio",
"answer_options": {
"0": "Yes",
"1": "No"
}
}
},
"depends_on": { "needstype": "Supported housing" }
}
}
},

7
db/migrate/20220110161957_add_nocharge_field.rb

@ -0,0 +1,7 @@
class AddNochargeField < ActiveRecord::Migration[7.0]
def change
change_table :case_logs, bulk: true do |t|
t.column :nocharge, :integer
end
end
end

3
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: 2022_01_10_115720) do
ActiveRecord::Schema.define(version: 2022_01_10_161957) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -179,6 +179,7 @@ ActiveRecord::Schema.define(version: 2022_01_10_115720) do
t.integer "totadult"
t.integer "net_income_known"
t.string "has_benefits"
t.integer "nocharge"
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"

1
spec/factories/case_log.rb

@ -148,6 +148,7 @@ FactoryBot.define do
armedforces { 1 }
builtype { 1 }
unitletas { 2 }
nocharge { "No" }
end
created_at { Time.zone.now }
updated_at { Time.zone.now }

3
spec/fixtures/complete_case_log.json vendored

@ -144,6 +144,7 @@
"property_wheelchair_accessible": "Yes",
"void_or_renewal_date": "05/05/2020",
"tenant_same_property_renewal": "Yes",
"new_build_handover_date": "01/01/2019"
"new_build_handover_date": "01/01/2019",
"nocharge": "No"
}
}

Loading…
Cancel
Save