mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-24 03:00:12 +01:00
html fixes and sort by number of todos logic
This commit is contained in:
parent
385f34d071
commit
0b57b23b2d
3 changed files with 15 additions and 7 deletions
|
|
@ -188,7 +188,16 @@ class ProjectsController < ApplicationController
|
|||
|
||||
def actionize
|
||||
@state = params['state']
|
||||
@projects = current_user.projects.actionize(:state => @state) if @state
|
||||
query_state = ''
|
||||
query_state = 'AND project.state = "' + params['state'] +'" 'if @state
|
||||
projects = Project.find_by_sql([
|
||||
"SELECT project.id, count(todo.id) as p_count " +
|
||||
"FROM projects as project " +
|
||||
"LEFT OUTER JOIN todos as todo ON todo.project_id = project.id "+
|
||||
"WHERE project.user_id = ? " +
|
||||
query_state +
|
||||
" GROUP BY project.id ORDER by p_count DESC",current_user.id])
|
||||
@projects = current_user.projects.actionize(projects,:state => @state) if @state
|
||||
@contexts = current_user.contexts
|
||||
init_not_done_counts(['project'])
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue