From a9150ba552c97dde6284d9cb46a3f954b05c4292 Mon Sep 17 00:00:00 2001 From: Wendel Fabian Chinsamy Date: Wed, 15 Jan 2025 11:45:45 +0200 Subject: [PATCH] add logging for debugging --- app/models/orcid_affiliation.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/models/orcid_affiliation.rb b/app/models/orcid_affiliation.rb index be44aea2..c81a0442 100644 --- a/app/models/orcid_affiliation.rb +++ b/app/models/orcid_affiliation.rb @@ -52,9 +52,10 @@ 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)) + related_identifiers = Array.wrap(attributes.fetch("relatedIdentifiers", nil)) skip_doi = related_identifiers.any? do |related_identifier| ["IsIdenticalTo", "IsPartOf", "IsPreviousVersionOf", "IsVersionOf"].include?(related_identifier["relatedIdentifierType"]) @@ -68,6 +69,7 @@ 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| @@ -77,6 +79,8 @@ 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"])