Merge pull request #8857 from mfo/US/fix-backfill_procedure_routing_criteria_name

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:
mfo 2023-04-04 14:46:53 +00:00 committed by GitHub
commit 46ce685ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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