Skip to content

Commit

Permalink
MDL-26568 block_online_users - reporting incorrect number of users
Browse files Browse the repository at this point in the history
When over 50 users were online the count used in the listing was incorrect
  • Loading branch information
danpoltawski authored and stronk7 committed Oct 25, 2011
1 parent 3f4186c commit 23f3d0e
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions blocks/online_users/block_online_users.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,10 @@ function get_content() {
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
Expand All @@ -85,14 +84,13 @@ function get_content() {
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;
}
Expand Down

0 comments on commit 23f3d0e

Please sign in to comment.