diff --git a/tracks/app/controllers/todo_controller.rb b/tracks/app/controllers/todo_controller.rb index 7d3606e6..873501d2 100644 --- a/tracks/app/controllers/todo_controller.rb +++ b/tracks/app/controllers/todo_controller.rb @@ -306,7 +306,7 @@ class TodoController < ApplicationController @projects = @user.projects @contexts = @user.contexts @todos = Todo.find(:all, :conditions => ['user_id = ? and type = ?', @user.id, "Immediate"]) - @done = Todo.find(:all, :conditions => ['user_id = ? and done = ?', @user.id, true]) + @done = Todo.find(:all, :conditions => ['user_id = ? and done = ?', @user.id, true], :order => 'completed DESC') # @todos = @todos.collect { |x| (x.class == Immediate) ? x : nil }.compact end diff --git a/tracks/app/models/context.rb b/tracks/app/models/context.rb index 329abc4a..7c5f11f4 100644 --- a/tracks/app/models/context.rb +++ b/tracks/app/models/context.rb @@ -26,7 +26,7 @@ class Context < ActiveRecord::Base def find_done_todos todos = Todo.find :all, :conditions => ["todos.context_id = #{id} AND todos.done = ? AND type = ?", true, "Immediate"], :include => [:context, :project], - :order => "due IS NULL, due ASC, created_at ASC", + :order => "completed DESC", :limit => @user.preferences["no_completed"].to_i end diff --git a/tracks/app/models/project.rb b/tracks/app/models/project.rb index f6c78210..85c7e046 100644 --- a/tracks/app/models/project.rb +++ b/tracks/app/models/project.rb @@ -33,7 +33,7 @@ class Project < ActiveRecord::Base def find_done_todos todos = Todo.find :all, :conditions => ["project_id = #{id} AND done = ?", true], - :order => "due IS NULL, due ASC, created_at ASC", + :order => "completed DESC", :limit => @user.preferences["no_completed"].to_i end