Merge remote-tracking branch 'upstream/dev'
This commit is contained in:
commit
1aa33f8f93
1 changed files with 14 additions and 0 deletions
14
lib/tasks/2018_02_14_clean_double_champ_private.rake
Normal file
14
lib/tasks/2018_02_14_clean_double_champ_private.rake
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
namespace :'2018_02_14_clean_double_champ_private' do
|
||||||
|
task clean: :environment do
|
||||||
|
Champ.where(private: true).group_by(&:dossier_id).each_value do |champs|
|
||||||
|
seen = []
|
||||||
|
champs.each do |champ|
|
||||||
|
if champ.type_de_champ_id.in?(seen)
|
||||||
|
champ.destroy
|
||||||
|
else
|
||||||
|
seen << champ.type_de_champ_id
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue