Task to split GeoArea with selection utilisateur in multiple polygons
This commit is contained in:
parent
22604013d0
commit
0d628bb96b
1 changed files with 18 additions and 0 deletions
|
@ -0,0 +1,18 @@
|
|||
namespace :after_party do
|
||||
desc 'Deployment task: split_geo_area_selection_multipolygons'
|
||||
task split_geo_area_selection_multipolygons: :environment do
|
||||
puts "Running deploy task 'split_geo_area_selection_multipolygons'"
|
||||
|
||||
Champs::CarteChamp.where.not(value: ['', '[]']).includes(:geo_areas).find_each do |champ|
|
||||
if champ.send(:selection_utilisateur_legacy?)
|
||||
legacy_selection_utilisateur = champ.selections_utilisateur.first
|
||||
champ.send(:legacy_selections_utilisateur).each do |area|
|
||||
champ.geo_areas << area
|
||||
end
|
||||
legacy_selection_utilisateur.destroy
|
||||
end
|
||||
end
|
||||
|
||||
AfterParty::TaskRecord.create version: '20200414104712'
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue