diff --git a/app/models/orcid_affiliation.rb b/app/models/orcid_affiliation.rb index 3bff69a..4e503f6 100644 --- a/app/models/orcid_affiliation.rb +++ b/app/models/orcid_affiliation.rb @@ -52,15 +52,12 @@ def push_data(result, _options = {}) end def self.push_item(item) - Rails.logger.info("[Event Import Worker]: orcid_affiliation push_item") - attributes = item.fetch("attributes", {}) related_identifiers = Array.wrap(attributes.fetch("relatedIdentifiers", nil)) skip_doi = related_identifiers.any? do |related_identifier| ["IsIdenticalTo", "IsPartOf", "IsPreviousVersionOf", "IsVersionOf"].include?(related_identifier["relatedIdentifierType"]) end - Rails.logger.info("[Event Import Worker]: orcid_affiliation skip_doi = #{skip_doi}") total_push_items = [] @@ -70,7 +67,6 @@ def self.push_item(item) n["nameIdentifierScheme"] == "ORCID" end skip_orcid = name_identifier.blank? - Rails.logger.info("[Event Import Worker]: orcid_affiliation skip_orcid = #{skip_orcid}") affiliation_identifiers = Array.wrap(creator).reduce([]) do |sum, c| Array.wrap(c["affiliation"]).each do |a| @@ -80,8 +76,6 @@ def self.push_item(item) sum end - Rails.logger.info("[Event Import Worker]: orcid_affiliation aff_identifiers = #{affiliation_identifiers}") - return nil if affiliation_identifiers.blank? || skip_doi || skip_orcid subj_id = normalize_orcid(name_identifier["nameIdentifier"]) @@ -112,6 +106,8 @@ def self.push_item(item) ssum end + Rails.logger.info("[Event Import Worker]: send orcid aff push_items = #{push_items.inspect}") + # there can be one or more affiliation_identifier per DOI Array.wrap(push_items).each do |iiitem| data = { @@ -133,6 +129,8 @@ def self.push_item(item) }, } + Rails.logger.info("[Event Import Worker]: send orcid aff to events") + Rails.logger.info("[Event Import Worker]: orcid data = #{data.inspect}") send_event_import_message(data) Rails.logger.info "[Event Data] #{iiitem['subj_id']} #{iiitem['relation_type_id']} #{iiitem['obj_id']} sent to the events queue."