correted order of todo user stats - best is displayed top
This commit is contained in:
parent
c8a9ffcbf3
commit
8ce8f717c3
@ -7,13 +7,17 @@ class SYS_SAIMOD_TODO_STATS_USERS extends \SYSTEM\DB\QQ {
|
|||||||
//pg
|
//pg
|
||||||
'TODO',
|
'TODO',
|
||||||
//mys
|
//mys
|
||||||
'SELECT username,
|
'SELECT *, state_closed/(state_open+state_closed) as best '.
|
||||||
sum(case when state = 0 then 1 else 0 end) state_open,
|
'FROM ('.
|
||||||
sum(case when state = 1 then 1 else 0 end) state_closed,
|
'SELECT username,'.
|
||||||
COUNT(*) as count
|
' sum(case when state = 0 then 1 else 0 end) state_open, '.
|
||||||
FROM system_todo_assign
|
' sum(case when state = 1 then 1 else 0 end) state_closed, '.
|
||||||
LEFT JOIN system_todo ON system_todo_assign.todo = system_todo.id
|
' COUNT(*) as count '.
|
||||||
LEFT JOIN system_user ON system_todo_assign.user = system_user.id
|
'FROM system_todo_assign '.
|
||||||
GROUP BY system_todo_assign.user
|
'LEFT JOIN system_todo ON system_todo_assign.todo = system_todo.id '.
|
||||||
ORDER BY count DESC;'
|
'LEFT JOIN system_user ON system_todo_assign.user = system_user.id '.
|
||||||
|
'GROUP BY system_todo_assign.user '.
|
||||||
|
'ORDER BY count DESC'.
|
||||||
|
') a '.
|
||||||
|
'ORDER BY best DESC;'
|
||||||
);}}
|
);}}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user