@@ -39,7 +39,7 class TimelogController < ApplicationController | |||
|
39 | 39 | |
|
40 | 40 | def index |
|
41 | 41 | sort_init 'spent_on', 'desc' |
|
42 | sort_update 'spent_on' => 'spent_on', | |
|
42 | sort_update 'spent_on' => ['spent_on', "#{TimeEntry.table_name}.created_on"], | |
|
43 | 43 | 'user' => 'user_id', |
|
44 | 44 | 'activity' => 'activity_id', |
|
45 | 45 | 'project' => "#{Project.table_name}.name", |
@@ -10,6 +10,7 http://www.redmine.org/ | |||
|
10 | 10 | * Defect #11061: Cannot choose commit versions to view differences in Git/Mercurial repository view |
|
11 | 11 | * Defect #11112: REST API - custom fields in POST/PUT ignored for time_entries |
|
12 | 12 | * Defect #11133: Wiki-page section edit link can point to incorrect section |
|
13 | * Defect #11178: Spent time sorted by date-descending order lists same-date entries in physical order | |
|
13 | 14 | * Feature #6597: Configurable session lifetime and timeout |
|
14 | 15 | * Patch #11113: Small glitch in German localization |
|
15 | 16 |
@@ -550,6 +550,20 class TimelogControllerTest < ActionController::TestCase | |||
|
550 | 550 | :attributes => {:action => "/projects/ecookbook/issues/1/time_entries", :id => 'query_form'} |
|
551 | 551 | end |
|
552 | 552 | |
|
553 | def test_index_should_sort_by_spent_on_and_created_on | |
|
554 | t1 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:00:00', :activity_id => 10) | |
|
555 | t2 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-16', :created_on => '2012-06-16 20:05:00', :activity_id => 10) | |
|
556 | t3 = TimeEntry.create!(:user => User.find(1), :project => Project.find(1), :hours => 1, :spent_on => '2012-06-15', :created_on => '2012-06-16 20:10:00', :activity_id => 10) | |
|
557 | ||
|
558 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16' | |
|
559 | assert_response :success | |
|
560 | assert_equal [t2, t1, t3], assigns(:entries) | |
|
561 | ||
|
562 | get :index, :project_id => 1, :from => '2012-06-15', :to => '2012-06-16', :sort => 'spent_on' | |
|
563 | assert_response :success | |
|
564 | assert_equal [t3, t1, t2], assigns(:entries) | |
|
565 | end | |
|
566 | ||
|
553 | 567 | def test_index_atom_feed |
|
554 | 568 | get :index, :project_id => 1, :format => 'atom' |
|
555 | 569 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now