From 1708e5d2b5d5077fb6c06b531a78c4946dfa3321 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 10:03:22 +0200 Subject: [PATCH] Do not add 24th hour, use 0 hour --- public/include/classes/statistics.class.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index d61222b0..e4e06167 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -403,10 +403,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $account_id, $account_id) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i <= 24; $i++) $aData[$i] = 0; + for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; while ($row = $result->fetch_assoc()) $aData[$row['hour']] = $row['hashrate']; // Fill any non-existing hours with 0 hashrate - for ($i = 0; $i <= 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData); } // Catchall @@ -440,10 +440,10 @@ class Statistics { GROUP BY HOUR(time)"); if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) { $iStartHour = date('G'); - for ($i = $iStartHour; $i <= 24; $i++) $aData[$i] = 0; + for ($i = $iStartHour; $i < 24; $i++) $aData[$i] = 0; while ($row = $result->fetch_assoc()) $aData[$row['hour']] = (int) $row['hashrate']; // Fill any non-existing hours with 0 hashrate - for ($i = 0; $i <= 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; + for ($i = 0; $i < 24; $i++) if (!array_key_exists($i, $aData)) $aData[$i] = 0; return $this->memcache->setCache(__FUNCTION__, $aData); } // Catchall