From 4a2076cced3227f05adce4561df2d1593a7d78ba Mon Sep 17 00:00:00 2001 From: Audrey Hamelers Date: Wed, 10 Jul 2024 19:22:36 +0200 Subject: [PATCH] don't silently delete primary DOIs that are already in related identifiers --- app/controllers/stash_datacite/publications_controller.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/controllers/stash_datacite/publications_controller.rb b/app/controllers/stash_datacite/publications_controller.rb index ffa6e5a2c7..6bf10b9557 100644 --- a/app/controllers/stash_datacite/publications_controller.rb +++ b/app/controllers/stash_datacite/publications_controller.rb @@ -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)