db(procedure): unroute cloned procedures from different admin

This commit is contained in:
Eric Leroy-Terquem 2023-09-21 15:26:01 +02:00
parent 70cc8dac4c
commit 07e971e4a3

View file

@ -0,0 +1,18 @@
namespace :after_party do
desc 'Deployment task: unroute_cloned_procedures_from_diffent_admin'
task unroute_cloned_procedures_from_diffent_admin: :environment do
puts "Running deploy task 'unroute_cloned_procedures_from_diffent_admin'"
# Put your task implementation HERE.
Procedure
.with_discarded
.where(routing_enabled: true)
.filter { |p| p.groupe_instructeurs.active.count == 1 }
.update_all(routing_enabled: false)
# 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