Skip to content

Commit

Permalink
add logging for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
wendelfabianchinsamy committed Jan 15, 2025
1 parent 06934e6 commit a9150ba
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/models/orcid_affiliation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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|
Expand All @@ -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"])
Expand Down

0 comments on commit a9150ba

Please sign in to comment.