fix(dossier): normalize champs commune data
This commit is contained in:
parent
0d1aa5cf96
commit
a6e3ea4839
3 changed files with 81 additions and 0 deletions
21
lib/tasks/deployment/20230407132756_normalize_communes.rake
Normal file
21
lib/tasks/deployment/20230407132756_normalize_communes.rake
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue