|
|
@ -95,6 +95,7 @@ module Imports |
|
|
|
(1..10).each do |index| |
|
|
|
(1..10).each do |index| |
|
|
|
attributes["illness_type_#{index}"] = illness_type(xml_doc, index, attributes["illness"]) |
|
|
|
attributes["illness_type_#{index}"] = illness_type(xml_doc, index, attributes["illness"]) |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
attributes["illness_type_0"] = 1 if (1..10).all? { |idx| attributes["illness_type_#{idx}"].nil? || attributes["illness_type_#{idx}"].zero? } |
|
|
|
|
|
|
|
|
|
|
|
attributes["prevten"] = unsafe_string_as_integer(xml_doc, "Q11") |
|
|
|
attributes["prevten"] = unsafe_string_as_integer(xml_doc, "Q11") |
|
|
|
attributes["prevloc"] = string_or_nil(xml_doc, "Q12aONS") |
|
|
|
attributes["prevloc"] = string_or_nil(xml_doc, "Q12aONS") |
|
|
@ -203,7 +204,7 @@ module Imports |
|
|
|
differences = [] |
|
|
|
differences = [] |
|
|
|
attributes.each do |key, value| |
|
|
|
attributes.each do |key, value| |
|
|
|
case_log_value = case_log.send(key.to_sym) |
|
|
|
case_log_value = case_log.send(key.to_sym) |
|
|
|
next if key == "majorrepairs" |
|
|
|
next if fields_not_present_in_softwire_data.include?(key) |
|
|
|
|
|
|
|
|
|
|
|
if value != case_log_value |
|
|
|
if value != case_log_value |
|
|
|
differences.push("#{key} #{value.inspect} #{case_log_value.inspect}") |
|
|
|
differences.push("#{key} #{value.inspect} #{case_log_value.inspect}") |
|
|
@ -212,6 +213,10 @@ module Imports |
|
|
|
@logger.warn "Differences found when saving log #{case_log.old_id}: #{differences}" unless differences.empty? |
|
|
|
@logger.warn "Differences found when saving log #{case_log.old_id}: #{differences}" unless differences.empty? |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fields_not_present_in_softwire_data |
|
|
|
|
|
|
|
%w[majorrepairs illness_type_0] |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def check_status_completed(case_log, previous_status) |
|
|
|
def check_status_completed(case_log, previous_status) |
|
|
|
if previous_status.include?("submitted") && case_log.status != "completed" |
|
|
|
if previous_status.include?("submitted") && case_log.status != "completed" |
|
|
|
@logger.warn "Case log #{case_log.id} is not completed" |
|
|
|
@logger.warn "Case log #{case_log.id} is not completed" |
|
|
|