filters need to be ordered so we get a consistent hash

pull/6827/head
jwollert 14 years ago
parent 1f5eeaeec6
commit d75b7a2922
  1. 5
      lib/report.rb

@ -31,7 +31,7 @@ class Report < ActiveRecord::Base
def serialize def serialize
# have to take the reverse to retain the original order when deserializing # have to take the reverse to retain the original order when deserializing
self.serialized = { :filters => filters.collect(&:serialize).reverse, :group_bys => group_bys.collect(&:serialize).reverse } self.serialized = { :filters => filters.collect(&:serialize).sort, :group_bys => group_bys.collect(&:serialize).reverse }
end end
def deserialize def deserialize
@ -135,6 +135,9 @@ class Report < ActiveRecord::Base
end end
def hash def hash
# serialize.tap do |serialized_query|
# serialized_query[:filters] = serialized_query[:filters].sort!
# end
(self.class.name + serialize.inspect).hash (self.class.name + serialize.inspect).hash
end end

Loading…
Cancel
Save