diff --git a/lib/tasks/deployment/20230613114744_replay_routing_engine_for_a_cloned_procedure.rake b/lib/tasks/deployment/20230613114744_replay_routing_engine_for_a_cloned_procedure.rake new file mode 100644 index 000000000..9d4f3a284 --- /dev/null +++ b/lib/tasks/deployment/20230613114744_replay_routing_engine_for_a_cloned_procedure.rake @@ -0,0 +1,25 @@ +namespace :after_party do + desc 'Deployment task: replay_routing_engine_for_a_cloned_procedure' + task replay_routing_engine_for_a_cloned_procedure: :environment do + puts "Running deploy task 'replay_routing_engine_for_a_cloned_procedure'" + + # Put your task implementation HERE. + dossiers = Procedure + .find(76266) + .dossiers + .en_construction + + progress = ProgressReport.new(dossiers.count) + + dossiers.find_each do |dossier| + RoutingEngine.compute(dossier) + 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