Browse Source

Fix ownershipsch so that it doesn't override to nil

pull/1353/head
Kat 3 years ago
parent
commit
468761f574
  1. 3
      app/services/imports/sales_logs_import_service.rb

3
app/services/imports/sales_logs_import_service.rb

@ -32,7 +32,8 @@ module Imports
attributes["created_at"] = Time.zone.parse(meta_field_value(xml_doc, "created-date")) attributes["created_at"] = Time.zone.parse(meta_field_value(xml_doc, "created-date"))
attributes["updated_at"] = Time.zone.parse(meta_field_value(xml_doc, "modified-date")) attributes["updated_at"] = Time.zone.parse(meta_field_value(xml_doc, "modified-date"))
attributes["purchid"] = string_or_nil(xml_doc, "PurchaserCode") attributes["purchid"] = string_or_nil(xml_doc, "PurchaserCode")
attributes["ownershipsch"] = unsafe_string_as_integer(xml_doc, "Ownership") || 1 if attributes["type"] == 2 # someties Ownership is missing, but type is set to 2 attributes["ownershipsch"] = unsafe_string_as_integer(xml_doc, "Ownership")
attributes["ownershipsch"] = 1 if attributes["type"] == 2 && attributes["ownershipsch"].blank? # someties Ownership is missing, but type is set to 2
attributes["othtype"] = string_or_nil(xml_doc, "Q38OtherSale") attributes["othtype"] = string_or_nil(xml_doc, "Q38OtherSale")
attributes["jointpur"] = unsafe_string_as_integer(xml_doc, "joint") attributes["jointpur"] = unsafe_string_as_integer(xml_doc, "joint")
attributes["jointmore"] = unsafe_string_as_integer(xml_doc, "JointMore") if attributes["joint"] == 1 attributes["jointmore"] = unsafe_string_as_integer(xml_doc, "JointMore") if attributes["joint"] == 1

Loading…
Cancel
Save