Task to add administrateur to administrateurs
This commit is contained in:
parent
84383fc3c1
commit
12e93391c9
1 changed files with 18 additions and 0 deletions
|
@ -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
|
Loading…
Reference in a new issue