##// END OF EJS Templates
Preload some associations....
Jean-Philippe Lang -
r11814:ef8dd0f64b70
parent child
Show More
@@ -46,7 +46,9 class TimelogController < ApplicationController
46 46
47 47 sort_init(@query.sort_criteria.empty? ? [['spent_on', 'desc']] : @query.sort_criteria)
48 48 sort_update(@query.sortable_columns)
49 scope = time_entry_scope(:order => sort_clause)
49 scope = time_entry_scope(:order => sort_clause).
50 includes(:project, :activity, :user, :issue).
51 preload(:issue => [:project, :tracker, :status, :assigned_to, :priority])
50 52
51 53 respond_to do |format|
52 54 format.html {
@@ -54,7 +56,6 class TimelogController < ApplicationController
54 56 @entry_count = scope.count
55 57 @entry_pages = Paginator.new @entry_count, per_page_option, params['page']
56 58 @entries = scope.all(
57 :include => [:project, :activity, :user, {:issue => :tracker}],
58 59 :limit => @entry_pages.per_page,
59 60 :offset => @entry_pages.offset
60 61 )
@@ -65,24 +66,20 class TimelogController < ApplicationController
65 66 format.api {
66 67 @entry_count = scope.count
67 68 @offset, @limit = api_offset_and_limit
68 @entries = scope.all(
69 :include => [:project, :activity, :user, {:issue => :tracker}],
69 @entries = scope.preload(:custom_values => :custom_field).all(
70 70 :limit => @limit,
71 71 :offset => @offset
72 72 )
73 73 }
74 74 format.atom {
75 75 entries = scope.reorder("#{TimeEntry.table_name}.created_on DESC").all(
76 :include => [:project, :activity, :user, {:issue => :tracker}],
77 76 :limit => Setting.feeds_limit.to_i
78 77 )
79 78 render_feed(entries, :title => l(:label_spent_time))
80 79 }
81 80 format.csv {
82 81 # Export all entries
83 @entries = scope.all(
84 :include => [:project, :activity, :user, {:issue => [:tracker, :assigned_to, :priority]}]
85 )
82 @entries = scope.all
86 83 send_data(query_to_csv(@entries, @query, params), :type => 'text/csv; header=present', :filename => 'timelog.csv')
87 84 }
88 85 end
General Comments 0
You need to be logged in to leave comments. Login now