From d4a4d4ac6d479d2ffaa5c9405597abbdc9e66bb7 Mon Sep 17 00:00:00 2001 From: Eric Durante Date: Wed, 15 Feb 2023 13:03:06 -0500 Subject: [PATCH] Record failure to find missing DOI (#699) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Record failure to find missing DOI We’ll need publications that hit this branch of the DOI verification logic to be manually reviewed by an admin, so we need to set the flag appropriately to make that happen. * Rubocop --------- Co-authored-by: Alex Kiessling --- app/jobs/doi_verification_job.rb | 2 ++ spec/component/jobs/doi_verification_job_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/jobs/doi_verification_job.rb b/app/jobs/doi_verification_job.rb index 5cc28403d..b3136de72 100644 --- a/app/jobs/doi_verification_job.rb +++ b/app/jobs/doi_verification_job.rb @@ -13,6 +13,8 @@ def perform(publication_id) response = UnpaywallClient.query_unpaywall(publication) if publication.matchable_title == response.matchable_title && response.doi.present? publication.update!(doi: response.doi, doi_verified: true) + else + publication.update!(doi_verified: false) end end end diff --git a/spec/component/jobs/doi_verification_job_spec.rb b/spec/component/jobs/doi_verification_job_spec.rb index e7ee96d16..e6ce6d4c5 100644 --- a/spec/component/jobs/doi_verification_job_spec.rb +++ b/spec/component/jobs/doi_verification_job_spec.rb @@ -67,8 +67,8 @@ expect(publication.reload.doi).to be_nil end - it 'does not update the doi verification' do - expect(publication.reload.doi_verified).to be_nil + it 'updates the doi verification to false' do + expect(publication.reload.doi_verified).to be false end end end @@ -83,8 +83,8 @@ expect(publication.reload.doi).to be_nil end - it 'does not update the doi verification' do - expect(publication.reload.doi_verified).to be_nil + it 'updates the doi verification to false' do + expect(publication.reload.doi_verified).to be false end end end