Skip to content

Commit

Permalink
update affiliation format. datacite/schema#56
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Jul 18, 2019
1 parent 3608fc8 commit 6127784
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/doi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -848,15 +848,15 @@ def set_defaults
def self.convert_affiliations
logger = Logger.new(STDOUT)

response = Doi.query("creators.affiliation:* -creators.affiliation.name:*", page: { size: 1, cursor: [] })
response = Doi.query("creators.affiliation:*", page: { size: 1, cursor: [] })
logger.info "#{response.results.total} DOIs found that have the affiliation in the old format."

if response.results.total > 0
# walk through results using cursor
cursor = []

while response.results.results.length > 0 do
response = Doi.query("creators.affiliation:* -creators.affiliation.name:*", page: { size: 1000, cursor: cursor })
response = Doi.query("creators.affiliation:*", page: { size: 1000, cursor: cursor })
break unless response.results.results.length > 0

logger.info "[Affiliation] Updating #{response.results.results.length} DOIs starting with _id #{response.results.to_a.first[:_id]}."
Expand Down

0 comments on commit 6127784

Please sign in to comment.