destroy newer legends

sort orders using `<` so first entries are the ones that should be destroyed
pull/13831/head
Alex Martín 7 years ago committed by GitHub
parent 86d0c62a26
commit 86ea4e7926
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -12,7 +12,7 @@ namespace :cartodb do
m2
end
end
legend_per_type.each { |_, l| l.sort_by(&:updated_at).slice(1..l.count).each(&:destroy) if l.size > 1 }
legend_per_type.each { |_, l| l.sort_by(&:updated_at).slice(0..l.count - 2).each(&:destroy) if l.size > 1 }
end
end
end

Loading…
Cancel
Save