Properly consider all of the filter facets

pull/6827/head
Alexander Bach 10 years ago
parent e8ea764643
commit 4989f9b33d
  1. 18
      lib/report/controller.rb

@ -107,6 +107,11 @@ module Report::Controller
# specified record or renders the updated table on XHR # specified record or renders the updated table on XHR
def update def update
if params[:set_filter].to_i == 1 # save if params[:set_filter].to_i == 1 # save
# TODO detect cost filter and do not remove it, remove every other filter
new_query = build_query(session[report_engine.name.underscore.to_sym][:filters],
session[report_engine.name.underscore.to_sym][:groups])
consolidate_additional_filters(new_query)
@query.migrate(new_query)
@query.save! @query.save!
end end
if request.xhr? if request.xhr?
@ -116,6 +121,19 @@ module Report::Controller
end end
end end
##
# with #19902 this should be removed
# Assuming if a cost filter exists it will always be the first, because of before_filter(s)
def consolidate_additional_filters(new_query)
if params[:unit]
cost_filter = @query.serialized[:filters].first
new_query.filter :cost_type_id,
operator: cost_filter[1][:operator],
value: params[:unit],
display: cost_filter[1][:display]
end
end
## ##
# Rename a record and update its publicity. Redirects to the updated record or # Rename a record and update its publicity. Redirects to the updated record or
# renders the updated name on XHR # renders the updated name on XHR

Loading…
Cancel
Save