fixes Report#to_params. we now return filters that can be selected in the ui, only

pull/6827/head
jwollert 14 years ago
parent 1922abb6c6
commit bb1fdd9bb9
  1. 5
      lib/report.rb

@ -51,14 +51,15 @@ class Report < ActiveRecord::Base
# Convenience method to generate a params hash readable by Controller#determine_settings
def to_params
params = { :fields => [], :operators => {}, :values => {}, :groups => { :rows => [], :columns => [] } }
filters.each do |f|
params = {}
filters.select { |f| f.class.display? }.each do |f|
filter_name = f.class.underscore_name
params[:fields] << filter_name
params[:operators].merge! filter_name => f.operator.to_s
params[:values].merge! filter_name => f.values
end
group_bys.each do |g|
params[:groups] ||= { :rows => [], :columns => [] }
params[:groups][g.row? ? :rows : :columns] << g.class.underscore_name
end
params

Loading…
Cancel
Save