@@ -67,13 +67,13 class TimelogController < ApplicationController | |||
|
67 | 67 | } |
|
68 | 68 | format.api { |
|
69 | 69 | @entry_count = TimeEntry.visible.count(:include => [:project, :issue], :conditions => cond.conditions) |
|
70 | @entry_pages = Paginator.new self, @entry_count, per_page_option, params['page'] | |
|
70 | @offset, @limit = api_offset_and_limit | |
|
71 | 71 | @entries = TimeEntry.visible.find(:all, |
|
72 | 72 | :include => [:project, :activity, :user, {:issue => :tracker}], |
|
73 | 73 | :conditions => cond.conditions, |
|
74 | 74 | :order => sort_clause, |
|
75 |
:limit => |
|
|
76 |
:offset => |
|
|
75 | :limit => @limit, | |
|
76 | :offset => @offset) | |
|
77 | 77 | } |
|
78 | 78 | format.atom { |
|
79 | 79 | entries = TimeEntry.visible.find(:all, |
@@ -1,4 +1,4 | |||
|
1 | api.array :time_entries do | |
|
1 | api.array :time_entries, api_meta(:total_count => @entry_count, :offset => @offset, :limit => @limit) do | |
|
2 | 2 | @entries.each do |time_entry| |
|
3 | 3 | api.time_entry do |
|
4 | 4 | api.id time_entry.id |
@@ -32,6 +32,16 class ApiTest::TimeEntriesTest < ActionController::IntegrationTest | |||
|
32 | 32 | assert_tag :tag => 'time_entries', |
|
33 | 33 | :child => {:tag => 'time_entry', :child => {:tag => 'id', :content => '2'}} |
|
34 | 34 | end |
|
35 | ||
|
36 | context "with limit" do | |
|
37 | should "return limited results" do | |
|
38 | get '/time_entries.xml?limit=2', {}, :authorization => credentials('jsmith') | |
|
39 | assert_response :success | |
|
40 | assert_equal 'application/xml', @response.content_type | |
|
41 | assert_tag :tag => 'time_entries', | |
|
42 | :children => {:count => 2} | |
|
43 | end | |
|
44 | end | |
|
35 | 45 | end |
|
36 | 46 | |
|
37 | 47 | context "GET /time_entries/2.xml" do |
General Comments 0
You need to be logged in to leave comments.
Login now