Skip to content

Commit

Permalink
don't silently delete primary DOIs that are already in related identi…
Browse files Browse the repository at this point in the history
…fiers
  • Loading branch information
ahamelers committed Jul 10, 2024
1 parent f0cbd98 commit 4a2076c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions app/controllers/stash_datacite/publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,9 @@ def save_doi

related_dois.each do |rd|
bare_related_doi = Stash::Import::Crossref.bare_doi(doi_string: rd.related_identifier)
return nil if bare_related_doi.include?(bare_form_doi) # user is entering a DOI that we already have
next unless bare_form_doi.include? bare_related_doi
next unless bare_form_doi.include?(bare_related_doi) || bare_related_doi.include?(bare_form_doi) # user is entering a DOI that we already have

standard_doi = RelatedIdentifier.standardize_doi(bare_form_doi)

# user is expanding on a DOI that we already have; update it in the DB (and change the work_type if needed)
rd.update(related_identifier: standard_doi, related_identifier_type: 'doi', work_type: 'primary_article',
hidden: false)
Expand Down

0 comments on commit 4a2076c

Please sign in to comment.