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