Browse Source

Move rent type to lettings log model

pull/2047/head
Kat 3 years ago
parent
commit
a5a8d7f860
  1. 8
      app/models/lettings_log.rb
  2. 12
      app/services/bulk_upload/lettings/year2022/row_parser.rb
  3. 12
      app/services/bulk_upload/lettings/year2023/row_parser.rb

8
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

12
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

12
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

Loading…
Cancel
Save