MDL-26568 block_online_users - reporting incorrect number of users

When over 50 users were online the count used in the listing was incorrect
This commit is contained in:
Dan Poltawski 2011-08-03 15:16:13 +01:00 committed by Eloy Lafuente (stronk7)
parent 462a064cf0
commit 10aeaf0f74

View File

@ -62,11 +62,10 @@ class block_online_users extends block_base {
GROUP BY $userfields
ORDER BY lastaccess DESC ";
$csql = "SELECT COUNT(u.id), u.id
$csql = "SELECT COUNT(u.id)
FROM {user} u $groupmembers
WHERE u.lastaccess > $timefrom
$groupselect
GROUP BY u.id";
$groupselect";
} else {
// Course level - show only enrolled users for now
@ -85,14 +84,13 @@ class block_online_users extends block_base {
GROUP BY $userfields
ORDER BY lastaccess DESC";
$csql = "SELECT u.id
$csql = "SELECT COUNT(u.id)
FROM {user_lastaccess} ul $groupmembers, {user} u
JOIN ($esqljoin) euj ON euj.id = u.id
WHERE ul.timeaccess > $timefrom
AND u.id = ul.userid
AND ul.courseid = :courseid
$groupselect
GROUP BY u.id";
$groupselect";
$params['courseid'] = $this->page->course->id;
}