From 61cc1482bdfec344218f822b8e61864b165ea459 Mon Sep 17 00:00:00 2001 From: lrbalt Date: Sat, 26 Apr 2008 20:22:32 +0000 Subject: [PATCH] fix todo feed of actions done in the past seven days. From mailinglist. Thanks Jason git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@833 a4c988fc-2ded-0310-b66e-134b36920a42 --- tracks/app/controllers/todos_controller.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tracks/app/controllers/todos_controller.rb b/tracks/app/controllers/todos_controller.rb index cb1850e3..d4533691 100644 --- a/tracks/app/controllers/todos_controller.rb +++ b/tracks/app/controllers/todos_controller.rb @@ -356,10 +356,11 @@ class TodosController < ApplicationController def with_feed_query_scope(&block) unless TodosController.is_feed_request(request) - yield - return + Todo.with_scope :find => {:conditions => ['todos.state = ?', 'active']} do + yield + return + end end - condition_builder = FindConditionBuilder.new if params.key?('done') @@ -440,10 +441,10 @@ class TodosController < ApplicationController # current_users.todos.find but that broke with_scope for :limit # Exclude hidden projects from count on home page - @todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ?', current_user.id, 'active'], :include => [ :project, :context, :tags ]) + @todos = Todo.find(:all, :conditions => ['todos.user_id = ?', current_user.id], :include => [ :project, :context, :tags ]) # Exclude hidden projects from the home page - @not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? and todos.state = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, 'active', false, 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ]) + @not_done_todos = Todo.find(:all, :conditions => ['todos.user_id = ? AND contexts.hide = ? AND (projects.state = ? OR todos.project_id IS NULL)', current_user.id, false, 'active'], :order => "todos.due IS NULL, todos.due ASC, todos.created_at ASC", :include => [ :project, :context, :tags ]) end end