mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-18 23:16:10 +01:00
Improvements to the init method in todo_controller to avoid an uneccesary SQL query. Thanks Luke!
Fixes #222. git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@201 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
c506c00cb7
commit
c1a66cf4a9
1 changed files with 1 additions and 3 deletions
|
|
@ -218,9 +218,7 @@ class TodoController < ApplicationController
|
|||
@projects = @user.projects
|
||||
@contexts = @user.contexts
|
||||
@todos = @user.todos
|
||||
@done = Todo.find(:all, :conditions => ["todos.user_id = ? and todos.done = ?", @user.id, true], :include => [:project], :order => "completed DESC")
|
||||
# for some reason, this generates an error about anil object under 0.14.2
|
||||
#@done = @todos.collect { |x| x.done? ? x:nil }.compact.sort! {|x,y| y.completed <=> x.completed }
|
||||
@done = @todos.find_all { |x| x.done }
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue