fix(dossier): normalize champs commune data

This commit is contained in:
Paul Chavard 2023-04-07 16:02:13 +02:00
parent 0d1aa5cf96
commit a6e3ea4839
3 changed files with 81 additions and 0 deletions

View file

@ -0,0 +1,21 @@
namespace :after_party do
desc 'Deployment task: normalize_communes'
task normalize_communes: :environment do
puts "Running deploy task 'normalize_communes'"
champs = Champs::CommuneChamp.where.not(external_id: nil)
progress = ProgressReport.new(champs.count)
champs.pluck(:id).in_groups_of(10_000, false) do |champ_ids|
Migrations::NormalizeCommunesJob.perform_later(champ_ids)
progress.inc(champ_ids.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