correctif(data): certaines procedures supprimées etaient invalides du fait qu'elle n'avaient pas ete mise a jour sur le critere du nom de routage

This commit is contained in:
Martin 2023-04-04 16:15:42 +02:00
parent 96740152c8
commit 144380fe4d

View file

@ -0,0 +1,20 @@
namespace :after_party do
desc 'Deployment task: fix_backfill_procedure_routing_criteria_name'
task fix_backfill_procedure_routing_criteria_name: :environment do
puts "Running deploy task 'fix_backfill_procedure_routing_criteria_name'"
# Put your task implementation HERE.
procedure_without_routing_criteria_name = Procedure.with_discarded.where(routing_criteria_name: nil)
progress = ProgressReport.new(procedure_without_routing_criteria_name.count)
procedure_without_routing_criteria_name.in_batches do |relation|
count = relation.count
relation.update_all(routing_criteria_name: 'Votre ville')
progress.inc(count)
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