From 4620e3b3c2fe3b5f0702b1ed320e5b395b6c2818 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Sun, 10 Feb 2019 18:22:47 +0100 Subject: [PATCH] set state to findable. #202 --- app/jobs/url_job.rb | 6 +++--- config/initializers/_version.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/jobs/url_job.rb b/app/jobs/url_job.rb index cf1a7de1a..7013bade2 100644 --- a/app/jobs/url_job.rb +++ b/app/jobs/url_job.rb @@ -14,14 +14,14 @@ def perform(doi_id) response = Doi.get_doi(doi: doi.doi) url = response.body.dig('data', 'values', 0, 'data', 'value') if url.present? - if %w(europ ethz).include?(doi.provider_id) && doi.minted.blank? - doi.update_attributes(url: url, minted: Time.zone.now, aasm_state: "findable") - elsif doi.is_registered_or_findable? && doi.minted.blank? + if (doi.is_registered_or_findable? || %w(europ ethz).include?(doi.provider_id)) && doi.minted.blank? doi.update_attributes(url: url, minted: Time.zone.now) else doi.update_attributes(url: url) end + doi.update_attributes(aasm_state: "findable") if %w(europ ethz).include?(doi.provider_id) + doi.__elasticsearch__.index_document logger.info "[Handle] URL #{url} set for DOI #{doi.doi}." diff --git a/config/initializers/_version.rb b/config/initializers/_version.rb index e444e60ea..74aeac24f 100644 --- a/config/initializers/_version.rb +++ b/config/initializers/_version.rb @@ -1,5 +1,5 @@ module Lupo class Application - VERSION = "2.3.28" + VERSION = "2.3.29" end end \ No newline at end of file