]> git.mjollnir.org Git - moodle.git/commitdiff
bugsquish! stats aggregates and weird missing dates bug
authormjollnir_ <mjollnir_>
Mon, 25 Sep 2006 04:50:17 +0000 (04:50 +0000)
committermjollnir_ <mjollnir_>
Mon, 25 Sep 2006 04:50:17 +0000 (04:50 +0000)
lib/statslib.php

index baccc009909d36c602c3f6c9ea3c678dfb3b8715..1d7cc22e6d4996535a6b9be9584eba8dbd2eabe1 100644 (file)
@@ -317,6 +317,9 @@ function stats_cron_weekly () {
                     WHERE courseid = '.$course->id.' AND '.$timesql.' AND stattype = \'logins\'';
                 
                 if ($stat = get_record_sql($sql)) {
+                    if (empty($stat->stat1)) {
+                        $stat->stat1 = 0;
+                    }
                     $stat->courseid = $course->id;
                     $stat->roleid = 0;
                     $stat->timeend = $nextsunday;
@@ -443,6 +446,9 @@ function stats_cron_monthly () {
                     WHERE courseid = '.$course->id.' AND '.$timesql.' AND stattype = \'logins\'';
                 
                 if ($stat = get_record_sql($sql)) {
+                    if (empty($stat->stat1)) {
+                        $stat->stat1 = 0;
+                    }
                     $stat->courseid = $course->id;
                     $stat->roleid = 0;
                     $stat->timeend = $nextmonthend;
@@ -1021,7 +1027,7 @@ function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) {
         $actualtimes[] = $s->timeend;
     }
 
-    $timeafter = array_pop($actualtimes);
+    $timeafter = array_pop(array_values($actualtimes));
 
     while ($timeafter < $now) {
         $times[] = $timeafter;