diff --git a/lib/tasks/doi.rake b/lib/tasks/doi.rake index 48a8531ae..89ada32c6 100644 --- a/lib/tasks/doi.rake +++ b/lib/tasks/doi.rake @@ -8,8 +8,13 @@ namespace :doi do desc 'Index all DOIs' task :index => :environment do - from_date = ENV['FROM_DATE'] || Date.current.beginning_of_month.strftime("%F") - until_date = ENV['UNTIL_DATE'] || Date.current.end_of_month.strftime("%F") + if ENV['YEAR'].present? + from_date = "#{ENV['YEAR']}-01-01" + until_date = "#{ENV['YEAR']}-12-31" + else + from_date = ENV['FROM_DATE'] || Date.current.beginning_of_month.strftime("%F") + until_date = ENV['UNTIL_DATE'] || Date.current.end_of_month.strftime("%F") + end response = Doi.index(from_date: from_date, until_date: until_date) puts response