Refactoring: Move controller code into cost query model

git-svn-id: https://dev.finn.de/svn/cockpit/trunk@640 7926756e-e54e-46e6-9721-ed318f58905e
pull/6827/head
hjust 15 years ago
parent c757389860
commit 9f17aec329
  1. 19
      app/models/cost_query.rb

@ -244,14 +244,19 @@ class CostQuery < ActiveRecord::Base
end
def self.retrieve (id=nil)
query = CostQuery.find_by_id(id) if id
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])
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]

Loading…
Cancel
Save