Reverted r640, r639 because stupid

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@650 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent 9f17aec329
commit 64470f3da3
  1. 16
      app/controllers/cost_reports_controller.rb
  2. 23
      app/models/cost_query.rb

@ -108,7 +108,7 @@ private
session[:cost_query] = {:id => @query.id, :project_id => @query.project_id}
sort_clear
else
if params[:set_filter] || session[:cost_query].blank? || session[:cost_query][:project_id] != (@project ? @project.id : nil)
if params[:set_filter] || session[:cost_query].nil? || session[:cost_query][:project_id] != (@project ? @project.id : nil)
# We have no current query or the query was reseted explicitly
# So generate a new query
@ -129,9 +129,19 @@ private
@query.display_time_entries = params[:cost_query][:display_time_entries]
end
@query.to_session
session[:cost_query] = {:project_id => @query.project_id,
:filters => @query.filters,
:group_by => @query.group_by,
:display_cost_entries => @query.display_cost_entries,
:display_time_entries => @query.display_time_entries}
else
@query = CostQuery.retrieve(session[:cost_query][:id])
@query = CostQuery.find_by_id(session[:cost_query][:id]) if session[:cost_query][:id]
@query ||= CostQuery.new(:name => "_",
:project => @project,
:filters => session[:cost_query][:filters],
:group_by => session[:cost_query][:group_by],
:display_cost_entries => session[:cost_query][:display_cost_entries],
:display_time_entries => session[:cost_query][:display_time_entries])
@query.project = @project
end
end

@ -235,29 +235,6 @@ class CostQuery < ActiveRecord::Base
return match.blank? ? nil : match[0]
end
def to_session
session[:cost_query] = {:project_id => project_id,
:filters => filters,
:group_by => group_by,
:display_cost_entries => display_cost_entries,
:display_time_entries => display_time_entries}
end
def self.retrieve (id=nil)
return CostQuery.find_by_id(id) if id
# fIXme: Handle the project_id here, not in a controller
if session[:cost_query]
CostQuery.new(:name => "_",
:filters => session[:cost_query][:filters],
:group_by => session[:cost_query][:group_by],
:display_cost_entries => session[:cost_query][:display_cost_entries],
:display_time_entries => session[:cost_query][:display_time_entries])
else
CostQuery.new(:name => "_")
end
end
MAGIC_GROUP_KEYS = [:block, :time, :display, :db_field, :other_group]
def self.grouping_column(*names, &block)

Loading…
Cancel
Save