From efd1442406ba19dc6be8c35d6b905a1c4343a035 Mon Sep 17 00:00:00 2001 From: MadeTech Dushan Date: Thu, 13 Jan 2022 14:30:50 +0000 Subject: [PATCH] create new constants for enums --- app/models/case_log.rb | 5 ++--- app/models/constants/case_log.rb | 13 +++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/models/case_log.rb b/app/models/case_log.rb index 4077e6d3b..7f5527fc5 100644 --- a/app/models/case_log.rb +++ b/app/models/case_log.rb @@ -47,9 +47,8 @@ class CaseLog < ApplicationRecord scope :for_organisation, ->(org) { where(owning_organisation: org).or(where(managing_organisation: org)) } - enum status: { "not_started" => 0, "in_progress" => 1, "completed" => 2 } - enum letting_in_sheltered_accomodation: { "Yes - sheltered housing" => 0, "Yes - extra care housing" => 1, "No" => 2, "Don't know" => 3 } - + enum status: STATUS + enum letting_in_sheltered_accomodation: SHELTERED_ACCOMODATION enum ethnic: ETHNIC enum national: NATIONAL, _suffix: true enum ecstat1: ECSTAT, _suffix: true diff --git a/app/models/constants/case_log.rb b/app/models/constants/case_log.rb index bf9fc55fa..cd401f55f 100644 --- a/app/models/constants/case_log.rb +++ b/app/models/constants/case_log.rb @@ -1081,4 +1081,17 @@ module Constants::CaseLog "Universal Credit with housing element (excluding housing benefit)", "Universal Credit (without housing element)", "Housing benefit and Universal Credit (without housing element)"].freeze + + STATUS = { + "not_started" => 0, + "in_progress" => 1, + "completed" => 2 + }.freeze + + SHELTERED_ACCOMODATION = { + "Yes - sheltered housing" => 0, + "Yes - extra care housing" => 1, + "No" => 2, + "Don't know" => 3 + }.freeze end