correctif(routing_criteria_name ne doit pas etre vide): ne pas oublier les procedures.routing_criteria_name ayant une chaine de caractère vide ex: ' '

This commit is contained in:
Martin 2022-10-11 09:59:23 +02:00 committed by Colin Darie
parent 3b5d1f8ee7
commit 202ae209a3

View file

@ -0,0 +1,16 @@
namespace :after_party do
desc 'Deployment task: backfill_procedure_routing_criteria_name_blank'
task backfill_procedure_routing_criteria_name_blank: :environment do
puts "Running deploy task 'backfill_procedure_routing_criteria_name_blank'"
# Put your task implementation HERE.
Procedure.pluck(:id, :routing_criteria_name)
.filter { |_id, r| r.blank? }
.map { |id, _r| Procedure.find(id).update(routing_criteria_name: 'Votre ville') }
# 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