23 lines
785 B
Ruby
23 lines
785 B
Ruby
|
namespace :after_party do
|
||
|
desc 'Deployment task: set_dossiers_processed_at'
|
||
|
task set_dossiers_processed_at: :environment do
|
||
|
puts "Running deploy task 'set_dossiers_processed_at'"
|
||
|
|
||
|
dossiers = Dossier.termine.includes(:traitement)
|
||
|
progress = ProgressReport.new(dossiers.count)
|
||
|
|
||
|
dossiers.find_each do |dossier|
|
||
|
if dossier.processed_at != dossier.traitement.processed_at
|
||
|
dossier.update_column(:processed_at, dossier.traitement.processed_at)
|
||
|
end
|
||
|
progress.inc
|
||
|
end
|
||
|
progress.finish
|
||
|
|
||
|
# Update task as completed. If you remove the line below, the task will
|
||
|
# run with every deploy (or every time you call after_party:run).
|
||
|
AfterParty::TaskRecord
|
||
|
.create version: AfterParty::TaskRecorder.new(__FILE__).timestamp
|
||
|
end
|
||
|
end
|