From 095fa7c1abcb36d2f54bddb4e1b0e3f48d7e932f Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Mon, 9 May 2022 17:14:10 +0100 Subject: [PATCH] Reorder import --- app/services/imports/case_logs_import_service.rb | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/services/imports/case_logs_import_service.rb b/app/services/imports/case_logs_import_service.rb index fb0ea84cc..cf7cd4cee 100644 --- a/app/services/imports/case_logs_import_service.rb +++ b/app/services/imports/case_logs_import_service.rb @@ -125,8 +125,8 @@ module Imports attributes["supcharg"] = safe_string_as_decimal(xml_doc, "Q18aiv") attributes["tcharge"] = safe_string_as_decimal(xml_doc, "Q18av") - attributes["hbrentshortfall"] = hbshortfall(xml_doc) attributes["tshortfall"] = safe_string_as_decimal(xml_doc, "Q18dyes") + attributes["hbrentshortfall"] = hbshortfall(xml_doc, attributes) attributes["voiddate"] = compose_date(xml_doc, "VDAY", "VMONTH", "VYEAR") attributes["mrcdate"] = compose_date(xml_doc, "MRCDAY", "MRCMONTH", "MRCYEAR") @@ -520,10 +520,9 @@ module Imports ((2..8).map { |x| string_or_nil(xml_doc, "P#{x}Rel") } + [string_or_nil(xml_doc, "P1Sex")]).compact end - def hbshortfall(xml_doc) + def hbshortfall(xml_doc, attributes) shortfall = unsafe_string_as_integer(xml_doc, "Q18d") - tshortfall = safe_string_as_decimal(xml_doc, "Q18dyes") - if tshortfall.blank? && shortfall == 1 && overridden?(xml_doc, "xmlns", "Q18dyes") + if attributes["tshortfall"].blank? && shortfall == 1 && overridden?(xml_doc, "xmlns", "Q18dyes") # If they have said there is a shortfall but then not entered one, and that has been # manually overridden we instead infer that they actually didn't know whether there is a shortfall. 3