From 50f380c25e2716668f7b8a90aa8ca7371e617996 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 15 Aug 2013 09:14:02 +0200 Subject: [PATCH] first test to fill with data --- public/include/classes/statistics.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 1452db89..70a2e986 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -406,6 +406,17 @@ class Statistics { while ($row = $result->fetch_assoc()) { $aData[$row['hour']] = $row['hashrate']; } + // We have no data, so we fill with 0 + if (empty($aData)) { + for ($i = 0; $i <= 24; $i++) $aData[$i] = 0; + } else { + $count = -1; + foreach ($aData as $hour => $hashrate) { + $count++; + if ($count == $hour) continue; + $aData[$count] = 0; + } + } return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData); } // Catchall