From 109947bb97a6040eb4083fe636ac8b9e9de65f41 Mon Sep 17 00:00:00 2001 From: Kat Date: Thu, 11 Nov 2021 09:28:09 +0000 Subject: [PATCH 1/7] Update majorrepairs field name in docs and test file --- app/admin/case_logs.rb | 2 +- docs/api/DLUHC-CORE-Data.v1.json | 6 +++--- spec/fixtures/complete_case_log.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb index c3716ad6d..6768befae 100644 --- a/app/admin/case_logs.rb +++ b/app/admin/case_logs.rb @@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters permit_params do - permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date property_major_repairs property_major_repairs_date property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] + permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs property_major_repairs_date property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] permitted end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index 654307a59..860255260 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -318,7 +318,7 @@ "property_building_type": "dummy", "beds": 3, "property_void_date": "03/11/2019", - "property_major_repairs": "Yes", + "majorrepairs": "Yes", "property_major_repairs_date": "05/05/2020", "offered": 2, "wchair": true, @@ -871,7 +871,7 @@ "type": "string", "minLength": 1 }, - "property_major_repairs": { + "majorrepairs": { "type": "string", "minLength": 1 }, @@ -1107,7 +1107,7 @@ "property_building_type", "beds", "property_void_date", - "property_major_repairs", + "majorrepairs", "property_major_repairs_date", "offered", "wchair", diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 7bca4a575..01fc5d998 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -63,7 +63,7 @@ "property_building_type": "dummy", "beds": 3, "property_void_date": "03/11/2019", - "property_major_repairs": "Yes", + "majorrepairs": "Yes", "property_major_repairs_date": "05/05/2020", "offered": 2, "wchair": "Yes", From 20bda98d4b8faff2337bc73a9ecdd72835174e2a Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 11 Nov 2021 14:44:55 +0000 Subject: [PATCH 2/7] Save mcr date as datetime, fix saving the dates (#85) --- app/admin/case_logs.rb | 2 +- app/controllers/case_logs_controller.rb | 6 +++++ app/models/case_log.rb | 20 +++++++++++++++++ config/forms/2021_2022.json | 4 ++-- db/migrate/20211110140928_add_mrc_dates.rb | 21 ++++++++++++++++++ db/schema.rb | 7 ++++-- docs/api/DLUHC-CORE-Data.v1.json | 6 ++--- spec/controllers/case_logs_controller_spec.rb | 22 +++++++++++++++++++ spec/fixtures/complete_case_log.json | 5 ++++- spec/fixtures/forms/test_form.json | 10 +++++++++ spec/models/form_handler_spec.rb | 2 +- 11 files changed, 95 insertions(+), 10 deletions(-) create mode 100644 db/migrate/20211110140928_add_mrc_dates.rb diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb index 6768befae..f32cff52b 100644 --- a/app/admin/case_logs.rb +++ b/app/admin/case_logs.rb @@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters permit_params do - permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs property_major_repairs_date property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] + permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] permitted end diff --git a/app/controllers/case_logs_controller.rb b/app/controllers/case_logs_controller.rb index cc2a4b484..8eb60af6a 100644 --- a/app/controllers/case_logs_controller.rb +++ b/app/controllers/case_logs_controller.rb @@ -103,6 +103,12 @@ private form = FormHandler.instance.get_form("2021_2022") form.expected_responses_for_page(page).each_with_object({}) do |(question_key, question_info), result| question_params = params["case_log"][question_key] + if question_info["type"] == "date" + day = params["case_log"]["#{question_key}(3i)"] + month = params["case_log"]["#{question_key}(2i)"] + year = params["case_log"]["#{question_key}(1i)"] + result[question_key] = Date.new(year.to_i, month.to_i, day.to_i) + end next unless question_params if %w[checkbox validation_override].include?(question_info["type"]) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index c058fb5f3..4d59ea91a 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -169,6 +169,26 @@ class CaseLog < ApplicationRecord IncomeRange::ALLOWED[ecstat1.to_sym] end + def mrcday + if mrcdate.present? + mrcdate.day + end + end + + def mrcmonth + if mrcdate.present? + mrcdate.month + end + end + + def mrcyear + if mrcdate.present? + mrcdate.year + end + end + + + private def update_status! diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 52d80f8ee..5606f956e 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -1585,10 +1585,10 @@ "1": "No" }, "conditional_for": { - "property_major_repairs_date": ["Yes"] + "mrcdate": ["Yes"] } }, - "property_major_repairs_date": { + "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", diff --git a/db/migrate/20211110140928_add_mrc_dates.rb b/db/migrate/20211110140928_add_mrc_dates.rb new file mode 100644 index 000000000..08c1c70d3 --- /dev/null +++ b/db/migrate/20211110140928_add_mrc_dates.rb @@ -0,0 +1,21 @@ +class AddMrcDates < ActiveRecord::Migration[6.1] + def up + change_table :case_logs, bulk: true do |t| + t.remove :property_major_repairs_date + t.column :mrcdate, :datetime + t.column :mrcday, :integer + t.column :mrcmonth, :integer + t.column :mrcyear, :integer + end + end + + def down + change_table :case_logs, bulk: true do |t| + t.column :property_major_repairs_date, :string + t.remove :mrcdate + t.remove :mrcday + t.remove :mrcmonth + t.remove :mrcyear + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a1b19f7f2..ba9b956dd 100644 --- a/db/schema.rb +++ b/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_11_08_134601) do +ActiveRecord::Schema.define(version: 2021_11_10_140928) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -78,7 +78,6 @@ ActiveRecord::Schema.define(version: 2021_11_08_134601) do t.string "property_building_type" t.integer "beds" t.string "property_void_date" - t.string "property_major_repairs_date" t.integer "offered" t.integer "wchair" t.integer "earnings" @@ -149,6 +148,10 @@ ActiveRecord::Schema.define(version: 2021_11_08_134601) do t.string "ppostc1" t.string "ppostc2" t.integer "property_relet" + t.datetime "mrcdate" + t.integer "mrcday" + t.integer "mrcmonth" + t.integer "mrcyear" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index 860255260..e13ad4f17 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -319,7 +319,7 @@ "beds": 3, "property_void_date": "03/11/2019", "majorrepairs": "Yes", - "property_major_repairs_date": "05/05/2020", + "mrcdate": "05/05/2020", "offered": 2, "wchair": true, "earnings": 1000, @@ -875,7 +875,7 @@ "type": "string", "minLength": 1 }, - "property_major_repairs_date": { + "mrcdate": { "type": "string", "minLength": 1 }, @@ -1108,7 +1108,7 @@ "beds", "property_void_date", "majorrepairs", - "property_major_repairs_date", + "mrcdate", "offered", "wchair", "earnings", diff --git a/spec/controllers/case_logs_controller_spec.rb b/spec/controllers/case_logs_controller_spec.rb index 40d93cc59..007b76f8c 100644 --- a/spec/controllers/case_logs_controller_spec.rb +++ b/spec/controllers/case_logs_controller_spec.rb @@ -177,6 +177,28 @@ RSpec.describe CaseLogsController, type: :controller do expect(case_log.ppostc2).to eq("2AE") end end + + context "partition date" do + let(:case_log_with_date) do + { + :"mrcdate(1i)" => "2021", + :"mrcdate(2i)" => "05", + :"mrcdate(3i)" => "04", + :page => "major_repairs_date", + } + end + it "saves full and partial dates" do + post :submit_form, params: { id: id, case_log: case_log_with_date } + case_log.reload + + expect(case_log.mrcdate.day).to eq(4) + expect(case_log.mrcdate.month).to eq(5) + expect(case_log.mrcdate.year).to eq(2021) + expect(case_log.mrcday).to eq(4) + expect(case_log.mrcmonth).to eq(5) + expect(case_log.mrcyear).to eq(2021) + end + end end describe "get_next_page_path" do diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 01fc5d998..97afaeaa0 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -64,7 +64,10 @@ "beds": 3, "property_void_date": "03/11/2019", "majorrepairs": "Yes", - "property_major_repairs_date": "05/05/2020", + "mrcdate": "05/05/2020", + "mrcday": 5, + "mrcmonth": 5, + "mrcyear": 2020, "offered": 2, "wchair": "Yes", "net_income_known": "Yes", diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json index 15764300b..95ac050da 100644 --- a/spec/fixtures/forms/test_form.json +++ b/spec/fixtures/forms/test_form.json @@ -510,6 +510,16 @@ "type": "text" } } + }, + "major_repairs_date": { + "questions": { + "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" + } + } } } } diff --git a/spec/models/form_handler_spec.rb b/spec/models/form_handler_spec.rb index ff6d4dc0f..f998c5557 100644 --- a/spec/models/form_handler_spec.rb +++ b/spec/models/form_handler_spec.rb @@ -15,7 +15,7 @@ RSpec.describe FormHandler do form_handler = FormHandler.instance form = form_handler.get_form("test_form") expect(form).to be_a(Form) - expect(form.all_pages.count).to eq(22) + expect(form.all_pages.count).to eq(23) end end From 894228c02e455d7b21ade57a6690c75c133352bb Mon Sep 17 00:00:00 2001 From: kosiakkatrina <54268893+kosiakkatrina@users.noreply.github.com> Date: Thu, 11 Nov 2021 15:50:05 +0000 Subject: [PATCH 3/7] CLDC-678: Store total household members (#86) * Store other housdehold members and infer total household members * Remove redundant question --- app/admin/case_logs.rb | 2 +- app/models/case_log.rb | 8 +++++++- app/validations/household_validations.rb | 2 +- config/forms/2021_2022.json | 16 ++-------------- .../20211111143319_add_other_members_column.rb | 7 +++++++ db/schema.rb | 3 ++- docs/api/DLUHC-CORE-Data.v1.json | 6 +++--- spec/features/case_log_spec.rb | 4 ++-- spec/fixtures/complete_case_log.json | 3 ++- spec/fixtures/forms/test_form.json | 2 +- spec/helpers/check_answers_helper_spec.rb | 2 +- spec/models/case_log_spec.rb | 4 ++-- 12 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 db/migrate/20211111143319_add_other_members_column.rb diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb index f32cff52b..2a15fbb2a 100644 --- a/app/admin/case_logs.rb +++ b/app/admin/case_logs.rb @@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters permit_params do - permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] + permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] permitted end diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 4d59ea91a..f21b3338d 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -163,6 +163,12 @@ class CaseLog < ApplicationRecord end end + def hhmemb + if other_hhmemb.present? + other_hhmemb + end + end + def applicable_income_range return unless ecstat1 @@ -239,7 +245,7 @@ private dynamically_not_required << "incfreq" end - start_range = (hhmemb || 0) + 2 + start_range = (other_hhmemb || 0) + 2 (start_range..8).each do |n| dynamically_not_required << "age#{n}" dynamically_not_required << "sex#{n}" diff --git a/app/validations/household_validations.rb b/app/validations/household_validations.rb index b36972667..d3536ae8a 100644 --- a/app/validations/household_validations.rb +++ b/app/validations/household_validations.rb @@ -80,7 +80,7 @@ module HouseholdValidations record.errors.add :unittype_gn, "A bedsit can only have one bedroom" end - if !record.hhmemb.nil? && record.hhmemb.positive? && (record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 7)) + if !record.other_hhmemb.nil? && record.other_hhmemb.positive? && (record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 7)) record.errors.add :unittype_gn, "A shared house must have 1 to 7 bedrooms" end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 5606f956e..5d06b8bd3 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -104,7 +104,7 @@ "header": "About this log", "description": "", "questions": { - "tenancy_start_date": { + "startdate": { "check_answer_label": "When is the tenancy start date?", "header": "What is the tenancy start date?", "hint_text": "For example, 27 3 2007", @@ -332,7 +332,7 @@ "header": "", "description": "", "questions": { - "hhmemb": { + "other_hhmemb": { "check_answer_label": "Number of Other Household Members", "header": "How many other people are there in the household?", "hint_text": "The maximum number of others is 7", @@ -1027,18 +1027,6 @@ } } }, - "tenancy_start_date": { - "header": "", - "description": "", - "questions": { - "startdate": { - "check_answer_label": "When is the tenancy start date?", - "header": "What is the tenancy start date?", - "hint_text": "For example, 27 3 2007", - "type": "date" - } - } - }, "starter_tenancy": { "header": "", "description": "", diff --git a/db/migrate/20211111143319_add_other_members_column.rb b/db/migrate/20211111143319_add_other_members_column.rb new file mode 100644 index 000000000..2c6ca2658 --- /dev/null +++ b/db/migrate/20211111143319_add_other_members_column.rb @@ -0,0 +1,7 @@ +class AddOtherMembersColumn < ActiveRecord::Migration[6.1] + def change + change_table :case_logs, bulk: true do |t| + t.column :other_hhmemb, :integer + end + end +end diff --git a/db/schema.rb b/db/schema.rb index ba9b956dd..5b1c02e62 100644 --- a/db/schema.rb +++ b/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_11_10_140928) do +ActiveRecord::Schema.define(version: 2021_11_11_143319) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -152,6 +152,7 @@ ActiveRecord::Schema.define(version: 2021_11_10_140928) do t.integer "mrcday" t.integer "mrcmonth" t.integer "mrcyear" + t.integer "other_hhmemb" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index e13ad4f17..17560d14c 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -263,7 +263,7 @@ "prevten": "Private sector tenancy", "armed_forces": "Yes - a regular", "ecstat1": "Full-time - 30 hours or more", - "hhmemb": 7, + "other_hhmemb": 7, "relat2": "Partner", "age2": 32, "sex2": "Male", @@ -459,7 +459,7 @@ "Prefer not to say" ] }, - "hhmemb": { + "other_hhmemb": { "type": "number", "minimum": 0, "maximum": 7 @@ -1052,7 +1052,7 @@ "prevten", "armed_forces", "ecstat1", - "hhmemb", + "other_hhmemb", "relat2", "age2", "sex2", diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index aa53b8c7d..b48572d62 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "Test Features" do tenant_code: { type: "text", answer: "BZ737", path: "tenant_code" }, age1: { type: "numeric", answer: 25, path: "person_1_age" }, sex1: { type: "radio", answer: "Female", path: "person_1_gender" }, - hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" }, + other_hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" }, } def fill_in_number_question(case_log_id, question, value, path) @@ -265,7 +265,7 @@ RSpec.describe "Test Features" do let(:last_question_for_subsection) { "household_number_of_other_members" } it "redirects to the check answers page when answering the last question and clicking save and continue" do - fill_in_number_question(id, "hhmemb", 0, last_question_for_subsection) + fill_in_number_question(id, "other_hhmemb", 0, last_question_for_subsection) expect(page).to have_current_path("/case_logs/#{id}/#{subsection}/check_answers") end diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 97afaeaa0..4656a04f8 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -8,7 +8,8 @@ "prevten": "Private sector tenancy", "armed_forces": "Yes - a regular", "ecstat1": "Full-time - 30 hours or more", - "hhmemb": 7, + "other_hhmemb": 7, + "hhmemb": 8, "relat2": "Partner", "age2": 32, "sex2": "Male", diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json index 95ac050da..988d2176e 100644 --- a/spec/fixtures/forms/test_form.json +++ b/spec/fixtures/forms/test_form.json @@ -45,7 +45,7 @@ }, "household_number_of_other_members": { "questions": { - "hhmemb": { + "other_hhmemb": { "check_answer_label": "Number of Other Household Members", "header": "How many other people are there in the household?", "hint_text": "The maximum number of others is 1", diff --git a/spec/helpers/check_answers_helper_spec.rb b/spec/helpers/check_answers_helper_spec.rb index 7ad04f081..ac3000f6b 100644 --- a/spec/helpers/check_answers_helper_spec.rb +++ b/spec/helpers/check_answers_helper_spec.rb @@ -6,7 +6,7 @@ RSpec.describe CheckAnswersHelper do FactoryBot.create( :case_log, :in_progress, - hhmemb: 1, + other_hhmemb: 1, relat2: "Partner", ) end diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index 438bf3c55..e663937db 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -109,7 +109,7 @@ RSpec.describe Form, type: :model do expect { CaseLog.create!(unittype_gn: "Shared bungalow", beds: 8, - hhmemb: 1) + other_hhmemb: 1) }.to raise_error(ActiveRecord::RecordInvalid) end @@ -117,7 +117,7 @@ RSpec.describe Form, type: :model do expect { CaseLog.create!(unittype_gn: "Shared bungalow", beds: 4, - hhmemb: 0) + other_hhmemb: 0) }.to raise_error(ActiveRecord::RecordInvalid) end From 3f885b4bc3101519784e0b0777a0c78207db8e54 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 11 Nov 2021 15:57:19 +0000 Subject: [PATCH 4/7] fix duplicate keys in form json letting_type --- config/forms/2021_2022.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 5606f956e..f28753d14 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -112,7 +112,7 @@ } } }, - "letting_type": { + "rent_type": { "header": "About this log", "description": "", "questions": { From 8a6207fb0091f641da2c35cc1531b4b664cc14ba Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 11 Nov 2021 16:49:46 +0000 Subject: [PATCH 5/7] Revert "fix duplicate keys in form json letting_type" This reverts commit 3f885b4bc3101519784e0b0777a0c78207db8e54. --- config/forms/2021_2022.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 859e5fa14..5d06b8bd3 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -112,7 +112,7 @@ } } }, - "rent_type": { + "letting_type": { "header": "About this log", "description": "", "questions": { From a714efeaf6b7b3646213ecdd51a49dc82124870f Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 11 Nov 2021 16:52:40 +0000 Subject: [PATCH 6/7] aggh reverted wrong commit --- config/forms/2021_2022.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 5d06b8bd3..859e5fa14 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -112,7 +112,7 @@ } } }, - "letting_type": { + "rent_type": { "header": "About this log", "description": "", "questions": { From 6d2a0a11b697d6c49b420c8fd1a5b7eac0a4c6c1 Mon Sep 17 00:00:00 2001 From: magicmilo Date: Thu, 11 Nov 2021 19:44:57 +0000 Subject: [PATCH 7/7] Revert "Merge branch 'main' of https://github.com/communitiesuk/mhclg-data-collection-beta" This reverts commit d1ae40dc3bd4a03c6805e7c2462b1d6c706dfed6, reversing changes made to 3f885b4bc3101519784e0b0777a0c78207db8e54. --- app/admin/case_logs.rb | 2 +- app/models/case_log.rb | 8 +------- app/validations/household_validations.rb | 2 +- config/forms/2021_2022.json | 16 ++++++++++++++-- .../20211111143319_add_other_members_column.rb | 7 ------- db/schema.rb | 3 +-- docs/api/DLUHC-CORE-Data.v1.json | 6 +++--- spec/features/case_log_spec.rb | 4 ++-- spec/fixtures/complete_case_log.json | 3 +-- spec/fixtures/forms/test_form.json | 2 +- spec/helpers/check_answers_helper_spec.rb | 2 +- spec/models/case_log_spec.rb | 4 ++-- 12 files changed, 28 insertions(+), 31 deletions(-) delete mode 100644 db/migrate/20211111143319_add_other_members_column.rb diff --git a/app/admin/case_logs.rb b/app/admin/case_logs.rb index 2a15fbb2a..f32cff52b 100644 --- a/app/admin/case_logs.rb +++ b/app/admin/case_logs.rb @@ -2,7 +2,7 @@ ActiveAdmin.register CaseLog do # See permitted parameters documentation: # https://github.com/activeadmin/activeadmin/blob/master/docs/2-resource-customization.md#setting-up-strong-parameters permit_params do - permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 other_hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] + permitted = %i[status tenant_code age1 sex1 tenant_ethnic_group tenant_nationality previous_housing_situation armed_forces ecstat1 hhmemb relat2 age2 sex2 ecstat2 relat3 age3 sex3 ecstat3 relat4 age4 sex4 ecstat4 relat5 age5 sex5 ecstat5 relat6 age6 sex6 ecstat6 relat7 age7 person_7_gender ecstat7 relat8 age8 sex8 ecstat8 homelessness reason benefit_cap_spare_room_subsidy armed_forces_active armed_forces_injured armed_forces_partner medical_conditions pregnancy accessibility_requirements condition_effects tenancy_code tenancy_start_date starter_tenancy fixed_term_tenancy tenancy_type letting_type letting_provider la previous_postcode property_relet property_vacancy_reason property_reference property_unit_type property_building_type property_number_of_bedrooms property_void_date majorrepairs mrcdate property_number_of_times_relet property_wheelchair_accessible net_income net_income_frequency net_income_uc_proportion hb rent_frequency basic_rent service_charge personal_service_charge support_charge total_charge tshortfall time_lived_in_la time_on_la_waiting_list prevloc property_postcode reasonable_preference reasonable_preference_reason cbl_letting chr_letting cap_letting hbrentshortfall other_reason accessibility_requirements_fully_wheelchair_accessible_housing accessibility_requirements_wheelchair_access_to_essential_rooms accessibility_requirements_level_access_housing accessibility_requirements_other_disability_requirements accessibility_requirements_no_disability_requirements accessibility_requirements_do_not_know accessibility_requirements_prefer_not_to_say condition_effects_vision condition_effects_hearing condition_effects_mobility condition_effects_dexterity condition_effects_stamina condition_effects_learning condition_effects_memory condition_effects_mental_health condition_effects_social_or_behavioral condition_effects_other condition_effects_prefer_not_to_say reasonable_preference_reason_homeless reasonable_preference_reason_unsatisfactory_housing reasonable_preference_reason_medical_grounds reasonable_preference_reason_avoid_hardship reasonable_preference_reason_do_not_know other_tenancy_type override_net_income_validation net_income_known] permitted end diff --git a/app/models/case_log.rb b/app/models/case_log.rb index f21b3338d..4d59ea91a 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -163,12 +163,6 @@ class CaseLog < ApplicationRecord end end - def hhmemb - if other_hhmemb.present? - other_hhmemb - end - end - def applicable_income_range return unless ecstat1 @@ -245,7 +239,7 @@ private dynamically_not_required << "incfreq" end - start_range = (other_hhmemb || 0) + 2 + start_range = (hhmemb || 0) + 2 (start_range..8).each do |n| dynamically_not_required << "age#{n}" dynamically_not_required << "sex#{n}" diff --git a/app/validations/household_validations.rb b/app/validations/household_validations.rb index d3536ae8a..b36972667 100644 --- a/app/validations/household_validations.rb +++ b/app/validations/household_validations.rb @@ -80,7 +80,7 @@ module HouseholdValidations record.errors.add :unittype_gn, "A bedsit can only have one bedroom" end - if !record.other_hhmemb.nil? && record.other_hhmemb.positive? && (record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 7)) + if !record.hhmemb.nil? && record.hhmemb.positive? && (record.unittype_gn.include?("Shared") && !record.beds.to_i.between?(1, 7)) record.errors.add :unittype_gn, "A shared house must have 1 to 7 bedrooms" end diff --git a/config/forms/2021_2022.json b/config/forms/2021_2022.json index 859e5fa14..f28753d14 100644 --- a/config/forms/2021_2022.json +++ b/config/forms/2021_2022.json @@ -104,7 +104,7 @@ "header": "About this log", "description": "", "questions": { - "startdate": { + "tenancy_start_date": { "check_answer_label": "When is the tenancy start date?", "header": "What is the tenancy start date?", "hint_text": "For example, 27 3 2007", @@ -332,7 +332,7 @@ "header": "", "description": "", "questions": { - "other_hhmemb": { + "hhmemb": { "check_answer_label": "Number of Other Household Members", "header": "How many other people are there in the household?", "hint_text": "The maximum number of others is 7", @@ -1027,6 +1027,18 @@ } } }, + "tenancy_start_date": { + "header": "", + "description": "", + "questions": { + "startdate": { + "check_answer_label": "When is the tenancy start date?", + "header": "What is the tenancy start date?", + "hint_text": "For example, 27 3 2007", + "type": "date" + } + } + }, "starter_tenancy": { "header": "", "description": "", diff --git a/db/migrate/20211111143319_add_other_members_column.rb b/db/migrate/20211111143319_add_other_members_column.rb deleted file mode 100644 index 2c6ca2658..000000000 --- a/db/migrate/20211111143319_add_other_members_column.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddOtherMembersColumn < ActiveRecord::Migration[6.1] - def change - change_table :case_logs, bulk: true do |t| - t.column :other_hhmemb, :integer - end - end -end diff --git a/db/schema.rb b/db/schema.rb index 5b1c02e62..ba9b956dd 100644 --- a/db/schema.rb +++ b/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_11_11_143319) do +ActiveRecord::Schema.define(version: 2021_11_10_140928) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -152,7 +152,6 @@ ActiveRecord::Schema.define(version: 2021_11_11_143319) do t.integer "mrcday" t.integer "mrcmonth" t.integer "mrcyear" - t.integer "other_hhmemb" t.index ["discarded_at"], name: "index_case_logs_on_discarded_at" end diff --git a/docs/api/DLUHC-CORE-Data.v1.json b/docs/api/DLUHC-CORE-Data.v1.json index 17560d14c..e13ad4f17 100644 --- a/docs/api/DLUHC-CORE-Data.v1.json +++ b/docs/api/DLUHC-CORE-Data.v1.json @@ -263,7 +263,7 @@ "prevten": "Private sector tenancy", "armed_forces": "Yes - a regular", "ecstat1": "Full-time - 30 hours or more", - "other_hhmemb": 7, + "hhmemb": 7, "relat2": "Partner", "age2": 32, "sex2": "Male", @@ -459,7 +459,7 @@ "Prefer not to say" ] }, - "other_hhmemb": { + "hhmemb": { "type": "number", "minimum": 0, "maximum": 7 @@ -1052,7 +1052,7 @@ "prevten", "armed_forces", "ecstat1", - "other_hhmemb", + "hhmemb", "relat2", "age2", "sex2", diff --git a/spec/features/case_log_spec.rb b/spec/features/case_log_spec.rb index b48572d62..aa53b8c7d 100644 --- a/spec/features/case_log_spec.rb +++ b/spec/features/case_log_spec.rb @@ -9,7 +9,7 @@ RSpec.describe "Test Features" do tenant_code: { type: "text", answer: "BZ737", path: "tenant_code" }, age1: { type: "numeric", answer: 25, path: "person_1_age" }, sex1: { type: "radio", answer: "Female", path: "person_1_gender" }, - other_hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" }, + hhmemb: { type: "numeric", answer: 2, path: "household_number_of_other_members" }, } def fill_in_number_question(case_log_id, question, value, path) @@ -265,7 +265,7 @@ RSpec.describe "Test Features" do let(:last_question_for_subsection) { "household_number_of_other_members" } it "redirects to the check answers page when answering the last question and clicking save and continue" do - fill_in_number_question(id, "other_hhmemb", 0, last_question_for_subsection) + fill_in_number_question(id, "hhmemb", 0, last_question_for_subsection) expect(page).to have_current_path("/case_logs/#{id}/#{subsection}/check_answers") end diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 4656a04f8..97afaeaa0 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -8,8 +8,7 @@ "prevten": "Private sector tenancy", "armed_forces": "Yes - a regular", "ecstat1": "Full-time - 30 hours or more", - "other_hhmemb": 7, - "hhmemb": 8, + "hhmemb": 7, "relat2": "Partner", "age2": 32, "sex2": "Male", diff --git a/spec/fixtures/forms/test_form.json b/spec/fixtures/forms/test_form.json index 988d2176e..95ac050da 100644 --- a/spec/fixtures/forms/test_form.json +++ b/spec/fixtures/forms/test_form.json @@ -45,7 +45,7 @@ }, "household_number_of_other_members": { "questions": { - "other_hhmemb": { + "hhmemb": { "check_answer_label": "Number of Other Household Members", "header": "How many other people are there in the household?", "hint_text": "The maximum number of others is 1", diff --git a/spec/helpers/check_answers_helper_spec.rb b/spec/helpers/check_answers_helper_spec.rb index ac3000f6b..7ad04f081 100644 --- a/spec/helpers/check_answers_helper_spec.rb +++ b/spec/helpers/check_answers_helper_spec.rb @@ -6,7 +6,7 @@ RSpec.describe CheckAnswersHelper do FactoryBot.create( :case_log, :in_progress, - other_hhmemb: 1, + hhmemb: 1, relat2: "Partner", ) end diff --git a/spec/models/case_log_spec.rb b/spec/models/case_log_spec.rb index e663937db..438bf3c55 100644 --- a/spec/models/case_log_spec.rb +++ b/spec/models/case_log_spec.rb @@ -109,7 +109,7 @@ RSpec.describe Form, type: :model do expect { CaseLog.create!(unittype_gn: "Shared bungalow", beds: 8, - other_hhmemb: 1) + hhmemb: 1) }.to raise_error(ActiveRecord::RecordInvalid) end @@ -117,7 +117,7 @@ RSpec.describe Form, type: :model do expect { CaseLog.create!(unittype_gn: "Shared bungalow", beds: 4, - other_hhmemb: 0) + hhmemb: 0) }.to raise_error(ActiveRecord::RecordInvalid) end