Skip to content

Commit

Permalink
Merge pull request #1916 from datadryad/recalc
Browse files Browse the repository at this point in the history
Batch curation stats recalculation
  • Loading branch information
ahamelers authored Nov 7, 2024
2 parents b2fd975 + 46b22b5 commit feb8577
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/tasks/stash_engine_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,7 @@ namespace :curation_stats do
desc 'Calculate any curation stats that are missing from v2 launch day until yesterday'
task recalculate_all: :environment do
launch_day = Date.new(2019, 9, 17)
(launch_day..Time.now.utc.to_date - 1.day).each do |date|
(launch_day..Time.now.utc.to_date - 1.day).find_each do |date|
print '.'
stats = StashEngine::CurationStats.find_or_create_by(date: date)
stats.recalculate unless stats.created_at > 2.seconds.ago
Expand All @@ -1207,7 +1207,7 @@ namespace :curation_stats do

desc 'Recalculate any curation stats from the past three days, not counting today'
task update_recent: :environment do
(Time.now.utc.to_date - 4.days..Time.now.utc.to_date - 1.day).each do |date|
(Time.now.utc.to_date - 4.days..Time.now.utc.to_date - 1.day).find_each do |date|
print '.'
stats = StashEngine::CurationStats.find_or_create_by(date: date)
stats.recalculate unless stats.created_at > 2.seconds.ago
Expand Down

0 comments on commit feb8577

Please sign in to comment.