Skip to content
Browse files

merged: fixing warnings in stats lib - rather than doing an include_o…

…nce and noticing for every missing mod, check the file exists first from MOODLE_16_STABLE, and fixed up some weirdness in the reports
  • Loading branch information...
1 parent 8a4f91b commit 77d596563896c2ad545c8e8be6f4c12e119f4319 mjollnir_ committed
Showing with 18 additions and 1 deletion.
  1. +10 −0 course/report/stats/graph.php
  2. +8 −1 course/report/stats/report.php
View
10 course/report/stats/graph.php
@@ -103,6 +103,16 @@
$times[$stat->timeend] = userdate($stat->timeend,get_string('strftimedate'),$CFG->timezone);
}
}
+ foreach (array_keys($times) as $t) {
+ foreach ($data as $roleid => $stuff) {
+ if (!array_key_exists($t, $stuff)) {
+ $data[$roleid][$t] = 0;
+ }
+ }
+ }
+ foreach ($data as $role => $stuff) {
+ ksort($data[$role]);
+ }
$nonzeroroleid = 0;
foreach (array_keys($data) as $roleid) {
if ($roleid == 0) {
View
9 course/report/stats/report.php
@@ -175,6 +175,13 @@
$rolesdata[$roleid] = 0;
}
}
+ else {
+ foreach (array_keys($roles) as $r) {
+ if (!array_key_exists($r, $rolesdata)) {
+ $rolesdata[$r] = 0;
+ }
+ }
+ }
krsort($rolesdata);
$row = array_merge(array($times[$time]),$rolesdata);
if (empty($CFG->loglifetime) || ($stat->timeend-(60*60*24)) >= (time()-60*60*24*$CFG->loglifetime)) {
@@ -197,4 +204,4 @@
}
}
-?>
+?>

0 comments on commit 77d5965

Please sign in to comment.
Something went wrong with that request. Please try again.