Moodle

Online Users block not updating

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.8.2
  • Fix Version/s: None
  • Component/s: Blocks
  • Labels:
    None
  • Environment:
    Moodle 1.8.2+ (2007021520)
  • Affected Branches:
    MOODLE_18_STABLE

Issue Links

Activity

Hide
Gary Marshall added a comment -

Somehow I hit enter before finishing with the issue editor.

Was using a daily build from last week. Only the admin login would show in the block. Install build from 8-21-2007 and not even admin gets listed now.

Env: PHP 5.1.6 / Apache 2.2.3

Show
Gary Marshall added a comment - Somehow I hit enter before finishing with the issue editor. Was using a daily build from last week. Only the admin login would show in the block. Install build from 8-21-2007 and not even admin gets listed now. Env: PHP 5.1.6 / Apache 2.2.3
Hide
Gary Marshall added a comment -

using MySQL 5.0.22

Just installed 1.9 beta. The block still not displaying anything. The _user_lastaccess table is empty as well. This system did have 1.8.0 on it originally and I didnt have a problem. Now I'm just confused.

Show
Gary Marshall added a comment - using MySQL 5.0.22 Just installed 1.9 beta. The block still not displaying anything. The _user_lastaccess table is empty as well. This system did have 1.8.0 on it originally and I didnt have a problem. Now I'm just confused.
Hide
Martin Dougiamas added a comment -

Can you try running a repair on your tables? Perhaps one or more are corrupted ... MySQL repair should fix it.

Show
Martin Dougiamas added a comment - Can you try running a repair on your tables? Perhaps one or more are corrupted ... MySQL repair should fix it.
Hide
Gary Marshall added a comment -

It appears the problem occurs when the tables are fresh - as in no student roles in classes. Probably not a bug per say. Might as well close this issue.

Show
Gary Marshall added a comment - It appears the problem occurs when the tables are fresh - as in no student roles in classes. Probably not a bug per say. Might as well close this issue.
Hide
Frédéric Hoogstoel added a comment -

Using Moodle 1.8.2 (2007021520) debian package, with Postgres 8.2.5 and PHP 5.2.4.2

I get the following SQL error when I show the Online Users block in debug mode.

"ERROR: column "u.username" must appear in the GROUP BY clause or be used in an aggregate function

SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess FROM mdl_user_lastaccess ul, mdl_user u WHERE ul.userid = u.id AND (ul.timeaccess > 1193671800 OR u.lastaccess > 1193671800) GROUP BY u.id ORDER BY ul.timeaccess DESC

  • line 677 of lib/dmllib.php: call to debugging()
  • line 918 of lib/dmllib.php: call to get_recordset_sql()
  • line 83 of blocks/online_users/block_online_users.php: call to get_records_sql()
  • line 202 of blocks/moodleblock.class.php: call to block_online_users->get_content()
  • line 226 of blocks/moodleblock.class.php: call to block_base->is_empty()
  • line 331 of lib/blocklib.php: call to block_base->_print_block()
  • line 275 of index.php: call to blocks_print_group()"

I think this is a true SQL coding error.
See http://www.postgresql.org/docs/8.2/interactive/queries-table-expressions.html#QUERIES-GROUP

In file block_online_users.php I would expect something like :
At line 67 :
$SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, MAX(u.lastaccess) AS mlastacess, MAX(ul.timeaccess) AS mtimeaccess
FROM {$CFG->prefix}user_lastaccess ul,
{$CFG->prefix}user u
$groupmembers
WHERE
ul.userid = u.id
$courseselect
$timeselect
$groupselect
GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture
ORDER BY MAX(ul.timeaccess) DESC";
At line 119 :
$timeago = format_time(time() - max($user->mtimeaccess, $user->mlastaccess)); //bruno to calculate correctly on frontpage

I wonder how we can choose between ordering by MAX(ul.timeaccess) and ordering by MAX(u.lastaccess) ?

Show
Frédéric Hoogstoel added a comment - Using Moodle 1.8.2 (2007021520) debian package, with Postgres 8.2.5 and PHP 5.2.4.2 I get the following SQL error when I show the Online Users block in debug mode. "ERROR: column "u.username" must appear in the GROUP BY clause or be used in an aggregate function SELECT u.id, u.username, u.firstname, u.lastname, u.picture, u.lastaccess, ul.timeaccess FROM mdl_user_lastaccess ul, mdl_user u WHERE ul.userid = u.id AND (ul.timeaccess > 1193671800 OR u.lastaccess > 1193671800) GROUP BY u.id ORDER BY ul.timeaccess DESC
  • line 677 of lib/dmllib.php: call to debugging()
  • line 918 of lib/dmllib.php: call to get_recordset_sql()
  • line 83 of blocks/online_users/block_online_users.php: call to get_records_sql()
  • line 202 of blocks/moodleblock.class.php: call to block_online_users->get_content()
  • line 226 of blocks/moodleblock.class.php: call to block_base->is_empty()
  • line 331 of lib/blocklib.php: call to block_base->_print_block()
  • line 275 of index.php: call to blocks_print_group()"
I think this is a true SQL coding error. See http://www.postgresql.org/docs/8.2/interactive/queries-table-expressions.html#QUERIES-GROUP In file block_online_users.php I would expect something like : At line 67 : $SQL = "SELECT u.id, u.username, u.firstname, u.lastname, u.picture, MAX(u.lastaccess) AS mlastacess, MAX(ul.timeaccess) AS mtimeaccess FROM {$CFG->prefix}user_lastaccess ul, {$CFG->prefix}user u $groupmembers WHERE ul.userid = u.id $courseselect $timeselect $groupselect GROUP BY u.id, u.username, u.firstname, u.lastname, u.picture ORDER BY MAX(ul.timeaccess) DESC"; At line 119 : $timeago = format_time(time() - max($user->mtimeaccess, $user->mlastaccess)); //bruno to calculate correctly on frontpage I wonder how we can choose between ordering by MAX(ul.timeaccess) and ordering by MAX(u.lastaccess) ?
Hide
Frédéric Hoogstoel added a comment - - edited

The SQL error was corrected in rev. 1.46.2.6 when splitting the query in 2 for site/course block respectively.
I have created a "blocker" link with issue MDL-9613, but I should have created a "duplicates" one.
Sorry. I don't know how to edit the link.

Show
Frédéric Hoogstoel added a comment - - edited The SQL error was corrected in rev. 1.46.2.6 when splitting the query in 2 for site/course block respectively. I have created a "blocker" link with issue MDL-9613, but I should have created a "duplicates" one. Sorry. I don't know how to edit the link.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: