Browse Source

Make sure we can log old id (#630)

pull/631/head v0.1.15
baarkerlounger 3 years ago committed by GitHub
parent
commit
e8c7e444ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      app/services/imports/case_logs_field_import_service.rb

11
app/services/imports/case_logs_field_import_service.rb

@ -14,7 +14,8 @@ module Imports
private private
def update_major_repairs(xml_doc) def update_major_repairs(xml_doc)
record = log(xml_doc) old_id = field_value(xml_doc, "meta", "document-id")
record = CaseLog.find_by(old_id:)
if record.present? if record.present?
previous_status = field_value(xml_doc, "meta", "status") previous_status = field_value(xml_doc, "meta", "status")
@ -36,7 +37,8 @@ module Imports
end end
def update_tenant_code(xml_doc) def update_tenant_code(xml_doc)
record = log(xml_doc) old_id = field_value(xml_doc, "meta", "document-id")
record = CaseLog.find_by(old_id:)
if record.present? if record.present?
tenant_code = string_or_nil(xml_doc, "_2bTenCode") tenant_code = string_or_nil(xml_doc, "_2bTenCode")
@ -50,11 +52,6 @@ module Imports
end end
end end
def log(xml_doc)
old_id = field_value(xml_doc, "meta", "document-id")
CaseLog.find_by(old_id:)
end
def compose_date(xml_doc, day_str, month_str, year_str) def compose_date(xml_doc, day_str, month_str, year_str)
day = Integer(field_value(xml_doc, "xmlns", day_str), exception: false) day = Integer(field_value(xml_doc, "xmlns", day_str), exception: false)
month = Integer(field_value(xml_doc, "xmlns", month_str), exception: false) month = Integer(field_value(xml_doc, "xmlns", month_str), exception: false)

Loading…
Cancel
Save