#4104 added checks (as cannot easily reproduce)

pull/4260/head
Kartones 9 years ago
parent 16628b4fbe
commit 9bfbe39414

@ -43,6 +43,10 @@ class Carto::Visualization < ActiveRecord::Base
belongs_to :map
def ==(other_visualization)
self.id == other_visualization.id
end
def size
# Only canonical visualizations (Datasets) have a related table and then count against disk quota,
# but we want to not break and even allow ordering by size multiple types

@ -55,6 +55,8 @@ module Carto
all = all.sort { |x, y|
x_attribute = is_array ? x.send(attribute).count : x.send(attribute)
y_attribute = is_array ? y.send(attribute).count : y.send(attribute)
x_attribute = 0 if x_attribute.nil?
y_attribute = 0 if y_attribute.nil?
asc_or_desc == :asc ? x_attribute <=> y_attribute : y_attribute <=> x_attribute
}
}

Loading…
Cancel
Save