Simplify hash method for reports

pull/6827/head
Tim Felgentreff 14 years ago
parent b6cb5c5185
commit 1f5eeaeec6
  1. 18
      lib/report.rb

@ -135,23 +135,7 @@ class Report < ActiveRecord::Base
end
def hash
report_string = ""
report_string.concat('filters: [')
report_string.concat(filters.map { |f|
f.class.underscore_name + f.operator.to_s + (f.values ? f.values.to_json : "")
}.sort.join(', '))
report_string.concat(']')
report_string.concat(', group_bys: {')
report_string.concat(group_bys.group_by(&:type).map { |t, gbs|
"#{t} : [#{gbs.collect(&:class).collect(&:underscore_name).join(', ')}]"
}.join(', '))
report_string.concat('}')
report_string.hash
(self.class.name + serialize.inspect).hash
end
def == another_report

Loading…
Cancel
Save