Sort by 'show_from' in tickler

This commit is contained in:
Carsten Otto 2015-04-12 23:22:04 +02:00 committed by Reinier Balt
parent 700305055f
commit aa14a8e802
2 changed files with 10 additions and 1 deletions

View file

@ -558,7 +558,7 @@ class TodosController < ApplicationController
includes = params[:format]=='xml' ? [:context, :project] : Todo::DEFAULT_INCLUDES
@not_done_todos = current_user.todos.deferred.includes(includes) + current_user.todos.pending.includes(includes)
@not_done_todos = current_user.todos.deferred.includes(includes).reorder('show_from') + current_user.todos.pending.includes(includes)
@todos_without_project = @not_done_todos.select{|t|t.project.nil?}
@down_count = @count = @not_done_todos.size

View file

@ -98,3 +98,12 @@ Feature: Manage deferred todos
| grouping |
| context |
| project |
Scenario: Opening the tickler page shows the deferred todos in order
Given I have a deferred todo "show tomorrow" in the context "Context B" deferred by 1 day
And I have a deferred todo "show in a year" in the context "Context B" deferred by 365 days
And I have a deferred todo "show in a week" in the context "Context B" deferred by 7 days
When I go to the tickler page
Then I should see "show tomorrow" before "show in a week"
And I should see "show tomorrow" before "show in a year"
And I should see "show in a week" before "show in a year"