From d6c4027dd2afb22e17121b55018ce8846633b72e Mon Sep 17 00:00:00 2001 From: magicmilo Date: Wed, 24 Nov 2021 13:34:17 +0000 Subject: [PATCH] add optional fields --- app/models/case_log.rb | 5 ++--- spec/fixtures/complete_case_log.json | 2 -- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index fa1c189f9..13290daa5 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -111,10 +111,9 @@ class CaseLog < ApplicationRecord enum property_relet: DbEnums.polar, _suffix: true enum armedforces: DbEnums.armed_forces, _suffix: true enum first_time_property_let_as_social_housing: DbEnums.polar, _suffix: true - enum do_you_know_the_postcode: DbEnums.polar, _suffix: true - enum do_you_know_the_local_authority: DbEnums.polar, _suffix: true AUTOGENERATED_FIELDS = %w[id status created_at updated_at discarded_at].freeze + OPTIONAL_FIELDS = %w[do_you_know_the_postcode do_you_know_the_local_authority].freeze def self.editable_fields attribute_names - AUTOGENERATED_FIELDS @@ -224,7 +223,7 @@ private end def mandatory_fields - required = attributes.except(*AUTOGENERATED_FIELDS) + required = attributes.except(*(AUTOGENERATED_FIELDS + OPTIONAL_FIELDS)) dynamically_not_required = [] diff --git a/spec/fixtures/complete_case_log.json b/spec/fixtures/complete_case_log.json index 8274e5bb0..2345097dc 100644 --- a/spec/fixtures/complete_case_log.json +++ b/spec/fixtures/complete_case_log.json @@ -138,8 +138,6 @@ "postcod2": "w3", "ppostc1": "w3", "ppostc2": "w3", - "do_you_know_the_postcode": "Yes", - "do_you_know_the_local_authority": "Yes", "why_dont_you_know_la": "Forgot", "first_time_property_let_as_social_housing": "Yes", "type_property_most_recently_let_as": "Affordable rent basis",