mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-03 06:21:49 +01:00
Fix context and project list feeds, which were broken in one of the last two changesets.
git-svn-id: http://www.rousette.org.uk/svn/tracks-repos/trunk@296 a4c988fc-2ded-0310-b66e-134b36920a42
This commit is contained in:
parent
c606e646b3
commit
7cf219afb9
2 changed files with 8 additions and 7 deletions
|
|
@ -82,13 +82,12 @@ class ApplicationController < ActionController::Base
|
|||
init_not_done_counts
|
||||
end
|
||||
|
||||
def init_not_done_counts
|
||||
@project_not_done_counts = Todo.count(:todo,
|
||||
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, "Immediate", false],
|
||||
:group => :project_id)
|
||||
@context_not_done_counts = Todo.count(:todo,
|
||||
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, "Immediate", false],
|
||||
:group => :context_id)
|
||||
def init_not_done_counts(parents = ['project','context'])
|
||||
parents.each {|parent|
|
||||
eval("@#{parent}_not_done_counts = Todo.count(:todo,
|
||||
:conditions => ['todos.user_id = ? and todos.type = ? and todos.done = ?', @user.id, \"Immediate\", false],
|
||||
:group => :#{parent}_id)")
|
||||
}
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -55,12 +55,14 @@ class FeedController < ApplicationController
|
|||
end
|
||||
|
||||
def list_projects_only
|
||||
init_not_done_counts('project')
|
||||
@projects = @user.projects
|
||||
@description = "Lists all the projects for #{@user.login}."
|
||||
render :action => 'projects_' + params['feedtype']
|
||||
end
|
||||
|
||||
def list_contexts_only
|
||||
init_not_done_counts('context')
|
||||
@contexts = @user.contexts
|
||||
@description = "Lists all the contexts for #{@user.login}."
|
||||
render :action => 'contexts_' + params['feedtype']
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue