Browse Source

test: update tests

pull/1173/head
natdeanlewissoftwire 3 years ago
parent
commit
02bde49f75
  1. 15
      app/services/imports/scheme_import_service.rb

15
app/services/imports/scheme_import_service.rb

@ -49,12 +49,6 @@ module Imports
attributes["arrangement_type"] = string_or_nil(xml_doc, "arrangement_type")
attributes["owning_org_old_id"] = string_or_nil(xml_doc, "institution")
attributes["owning_organisation_id"] = find_owning_organisation_id(attributes["owning_org_old_id"])
attributes["management_org_old_visible_id"] = safe_string_as_integer(xml_doc, "agent")
attributes["managing_organisation_id"] = find_managing_organisation_id(attributes["management_org_old_visible_id"])
if attributes["arrangement_type"] == "D" && attributes["managing_organisation_id"].nil?
attributes["managing_organisation_id"] = attributes["owning_organisation_id"]
end
attributes
end
@ -65,14 +59,5 @@ module Imports
organisation.id
end
def find_managing_organisation_id(old_visible_id)
return unless old_visible_id
organisation = Organisation.find_by(old_visible_id:)
raise "Organisation not found with legacy visible ID #{old_visible_id}" if organisation.nil?
organisation.id
end
end
end

Loading…
Cancel
Save