Merge pull request #8319 from colinux/fix-geoarea-without-source
fix(geo_area): missing source on 1 record
This commit is contained in:
commit
69f964e4a3
1 changed files with 21 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
||||||
|
namespace :after_party do
|
||||||
|
desc 'Deployment task: fix_geo_area_missing_source'
|
||||||
|
task fix_geo_area_missing_source: :environment do
|
||||||
|
puts "Running deploy task 'fix_geo_area_missing_source'"
|
||||||
|
|
||||||
|
geo_areas = GeoArea.where(source: nil)
|
||||||
|
progress = ProgressReport.new(geo_areas.count)
|
||||||
|
geo_areas.find_each do |geo_area|
|
||||||
|
geo_area.source = GeoArea.sources.fetch(:selection_utilisateur)
|
||||||
|
geo_area.save!
|
||||||
|
|
||||||
|
progress.inc
|
||||||
|
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…
Reference in a new issue