fix broken Report#cache_key method, needs to be independent filter order

pull/6827/head
jwollert 14 years ago
parent c36ce96747
commit 1b9bb59cf7
  1. 2
      lib/report.rb
  2. 8
      lib/report/filter/base.rb

@ -150,7 +150,7 @@ class Report < ActiveRecord::Base
def cache_key
deserialize unless @chain
parts = [self.class.table_name.sub('_reports', '')]
parts.concat [filters, group_bys].map { |l| l.map(&:cache_key).sort.join(" ") }
parts.concat [filters.sort, group_bys].map { |l| l.map(&:cache_key).join(" ") }
parts.join '/'
end

@ -26,7 +26,7 @@ class Report::Filter
end
def cache_key
self.class.cache_key + operator.to_s + values.join(',')
self.class.cache_key + operator.to_s + Array(values).join(',')
end
##
@ -60,6 +60,12 @@ class Report::Filter
alias :dependents :dependent
end
# need this for sort
def <=> other
self.class.underscore_name <=> other.class.underscore_name
end
def self.has_dependent?
!dependents.empty?
end

Loading…
Cancel
Save