From a5a8d7f8604a6e62d4af98b2a3df27b79a439ab2 Mon Sep 17 00:00:00 2001 From: Kat Date: Tue, 21 Nov 2023 10:09:01 +0000 Subject: [PATCH] Move rent type to lettings log model --- app/models/lettings_log.rb | 8 ++++++++ .../bulk_upload/lettings/year2022/row_parser.rb | 12 ++++++------ .../bulk_upload/lettings/year2023/row_parser.rb | 12 ++++++------ 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/app/models/lettings_log.rb b/app/models/lettings_log.rb index cba85320a..65ea6fe8e 100644 --- a/app/models/lettings_log.rb +++ b/app/models/lettings_log.rb @@ -128,6 +128,14 @@ class LettingsLog < Log SUFFIX_FROM_PERIOD = { 2 => "every 2 weeks", 3 => "every 4 weeks", 4 => "every month" }.freeze RETIREMENT_AGES = { "M" => 67, "F" => 60, "X" => 67 }.freeze DUPLICATE_LOG_ATTRIBUTES = %w[owning_organisation_id tenancycode startdate age1_known age1 sex1 ecstat1 tcharge household_charge chcharge].freeze + RENT_TYPE = { + social_rent: 0, + affordable_rent: 1, + london_affordable_rent: 2, + rent_to_buy: 3, + london_living_rent: 4, + other_intermediate_rent_product: 5, + }.freeze def form FormHandler.instance.get_form(form_name) || FormHandler.instance.current_lettings_form diff --git a/app/services/bulk_upload/lettings/year2022/row_parser.rb b/app/services/bulk_upload/lettings/year2022/row_parser.rb index 5a9ef579c..8aaa38b43 100644 --- a/app/services/bulk_upload/lettings/year2022/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2022/row_parser.rb @@ -1017,21 +1017,21 @@ private def rent_type case renttype when :social - Imports::LettingsLogsImportService::RENT_TYPE[:social_rent] + LettingsLog::RENT_TYPE[:social_rent] when :affordable if field_129 == 1 - Imports::LettingsLogsImportService::RENT_TYPE[:london_affordable_rent] + LettingsLog::RENT_TYPE[:london_affordable_rent] else - Imports::LettingsLogsImportService::RENT_TYPE[:affordable_rent] + LettingsLog::RENT_TYPE[:affordable_rent] end when :intermediate case field_130 when 1 - Imports::LettingsLogsImportService::RENT_TYPE[:rent_to_buy] + LettingsLog::RENT_TYPE[:rent_to_buy] when 2 - Imports::LettingsLogsImportService::RENT_TYPE[:london_living_rent] + LettingsLog::RENT_TYPE[:london_living_rent] when 3 - Imports::LettingsLogsImportService::RENT_TYPE[:other_intermediate_rent_product] + LettingsLog::RENT_TYPE[:other_intermediate_rent_product] end end end diff --git a/app/services/bulk_upload/lettings/year2023/row_parser.rb b/app/services/bulk_upload/lettings/year2023/row_parser.rb index 0ba078efc..511f4336b 100644 --- a/app/services/bulk_upload/lettings/year2023/row_parser.rb +++ b/app/services/bulk_upload/lettings/year2023/row_parser.rb @@ -1318,21 +1318,21 @@ private def rent_type case renttype when :social - Imports::LettingsLogsImportService::RENT_TYPE[:social_rent] + LettingsLog::RENT_TYPE[:social_rent] when :affordable if field_10 == 1 - Imports::LettingsLogsImportService::RENT_TYPE[:london_affordable_rent] + LettingsLog::RENT_TYPE[:london_affordable_rent] else - Imports::LettingsLogsImportService::RENT_TYPE[:affordable_rent] + LettingsLog::RENT_TYPE[:affordable_rent] end when :intermediate case field_11 when 1 - Imports::LettingsLogsImportService::RENT_TYPE[:rent_to_buy] + LettingsLog::RENT_TYPE[:rent_to_buy] when 2 - Imports::LettingsLogsImportService::RENT_TYPE[:london_living_rent] + LettingsLog::RENT_TYPE[:london_living_rent] when 3 - Imports::LettingsLogsImportService::RENT_TYPE[:other_intermediate_rent_product] + LettingsLog::RENT_TYPE[:other_intermediate_rent_product] end end end