Task to add administrateur to administrateurs

This commit is contained in:
Paul Chavard 2019-02-14 11:54:46 +01:00
parent 84383fc3c1
commit 12e93391c9

View file

@ -0,0 +1,18 @@
namespace :after_party do
desc 'Deployment task: add_procedure_administrateur_to_administrateurs'
task add_procedure_administrateur_to_administrateurs: :environment do
rake_puts "Running deploy task: 'add_procedure_administrateur_to_administrateurs'"
procedures = Procedure.includes(:administrateurs)
progress = ProgressReport.new(procedures.count)
procedures.find_each do |procedure|
if !procedure.administrateurs.include?(procedure.administrateur)
procedure.administrateurs << procedure.administrateur
end
progress.inc
end
progress.finish
AfterParty::TaskRecord.create version: '20190214101524'
end
end