Browse Source

Change Constant names prefix with Import_mapping

CLDC-1222-improve-case-log-import-performance
Mo Seedat 2 years ago
parent
commit
1898b740b1
  1. 12
      app/services/imports/lettings_logs_import_service.rb

12
app/services/imports/lettings_logs_import_service.rb

@ -51,6 +51,10 @@ module Imports
other_intermediate_rent_product: 3, other_intermediate_rent_product: 3,
}.freeze }.freeze
# TODO: RENT_TYPE enum values are referenced in lettings_log.rb
# but are described here. Similar situation with many other fields.
# Propose moving to LettingLog
#
# These must match our form # These must match our form
RENT_TYPE = { RENT_TYPE = {
social_rent: 0, social_rent: 0,
@ -61,7 +65,7 @@ module Imports
other_intermediate_rent_product: 5, other_intermediate_rent_product: 5,
}.freeze }.freeze
SEX = { IMPORT_MAPPING_SEX = {
"Male" => "M", "Male" => "M",
"Female" => "F", "Female" => "F",
"Other" => "X", "Other" => "X",
@ -69,7 +73,7 @@ module Imports
"Refused" => "R", "Refused" => "R",
}.freeze }.freeze
RELATION = { IMPORT_MAPPING_RELATION = {
"Child" => "C", "Child" => "C",
"Partner" => "P", "Partner" => "P",
"Other" => "X", "Other" => "X",
@ -445,12 +449,12 @@ module Imports
def sex(xml_doc, index) def sex(xml_doc, index)
unmapped_sex = string_or_nil(xml_doc, "P#{index}Sex") unmapped_sex = string_or_nil(xml_doc, "P#{index}Sex")
SEX[unmapped_sex] IMPORT_MAPPING_SEX[unmapped_sex]
end end
def relat(xml_doc, index) def relat(xml_doc, index)
unmapped_relation = string_or_nil(xml_doc, "P#{index}Rel") unmapped_relation = string_or_nil(xml_doc, "P#{index}Rel")
RELATION[unmapped_relation] IMPORT_MAPPING_RELATION[unmapped_relation]
end end
def age_known(xml_doc, index, hhmemb) def age_known(xml_doc, index, hhmemb)

Loading…
Cancel
Save