MDL-55367 report_log: Prevent invalid time to be passed to Charts API

This commit is contained in:
Simey Lameze 2016-07-28 15:58:14 +08:00
parent d1a3ea62ef
commit c5a90a4a5d

View File

@ -576,7 +576,9 @@ function report_log_userall_data($course, $user, $logreader) {
$rawlogs = report_log_usercourse($user->id, $courseselect, $coursestart, $logreader);
foreach ($rawlogs as $rawlog) {
$logs['series'][$rawlog->day] = $rawlog->num;
if (isset($logs['labels'][$rawlog->day])) {
$logs['series'][$rawlog->day] = $rawlog->num;
}
}
return $logs;
@ -616,7 +618,9 @@ function report_log_usertoday_data($course, $user, $date, $logreader) {
$rawlogs = report_log_userday($user->id, $courseselect, $daystart, $logreader);
foreach ($rawlogs as $rawlog) {
$logs['series'][$rawlog->hour] = $rawlog->num;
if (isset($logs['labels'][$rawlog->hour])) {
$logs['series'][$rawlog->hour] = $rawlog->num;
}
}
return $logs;