From 8a6c8bbbcb1b5e7fadb162cf810fe61a8b53a46d Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Tue, 25 Dec 2018 09:04:24 +0100 Subject: [PATCH] update minted status for dois registered in different handle system --- app/jobs/url_job.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/jobs/url_job.rb b/app/jobs/url_job.rb index 62612d06d..33fc9a2ab 100644 --- a/app/jobs/url_job.rb +++ b/app/jobs/url_job.rb @@ -11,7 +11,12 @@ def perform(doi) response = Maremma.head(doi.identifier, limit: 0) if response.headers.present? - doi.update_attributes(url: response.headers["location"]) + if doi.is_registered_or_findable && doi.minted.blank? + doi.update_attributes(url: response.headers["location"], minted: Time.zone.now) + else + doi.update_attributes(url: response.headers["location"]) + end + logger.debug "Set URL #{response.headers["location"]} for DOI #{doi.doi}" end end