Bug in 'report.php'

Bug in 'report.php'

by Jarkko Leponiemi -
Number of replies: 2
Hi,

Several people have reported difficulties in viewing past sessions. We had the same problem in version 1.4.2. It appears that file 'report.php' has a small error that hides the first session in the chat. I  made the following addition (in bold) to lines 137-141:

if (empty($messages)) {   /// May have already got them above
if (!$messages = get_records_select("chat_messages", "chatid = '$chat->id' $groupselect", "timestamp DESC")) {
print_heading(get_string("nomessages", "chat"));
print_footer($course);
exit;
}
unset($dummymessage);
$dummymessage->system = 1;
$dummymessage->timestamp = 0;
$dummymessage->userid = 1;
$messages[] = $dummymessage;
}

And yes, I admit it is a 'lazy' solution, but it seems to work anyway...

Average of ratings: -
In reply to Jarkko Leponiemi

Re: Bug in 'report.php'

by Jarkko Leponiemi -
Oh, I forgot to tell you that you may not have stumbled into this bug because it only affects the first session. This might just be a 'test' visit made by the teacher long (5 minutes) before any students attend the chat. If this 'session' only includes system messages ('enter' and 'exit') it is not visible, thus the bug does not matter.

However, if the first session is 'the real thing' the bug does matter.
In reply to Jarkko Leponiemi

Re: Bug in 'report.php'

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
This long-standing bug that prevented the first chat session being displayed in the logs has now been fixed in CVS (1.4.3 and 1.5).

I did it differently, but thanks for posting a fix, Jarkko!