Skip to content

Commit

Permalink
index dois by year
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 15, 2018
1 parent 9562477 commit fa38299
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/tasks/doi.rake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fa38299

Please sign in to comment.