From af5d9f6a06c5c755d468304b7f46e2387ce06c66 Mon Sep 17 00:00:00 2001 From: mjollnir_ Date: Mon, 25 Sep 2006 04:50:17 +0000 Subject: [PATCH] bugsquish! stats aggregates and weird missing dates bug --- lib/statslib.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/statslib.php b/lib/statslib.php index baccc00990..1d7cc22e6d 100644 --- a/lib/statslib.php +++ b/lib/statslib.php @@ -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; -- 2.39.5