diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index edbc24a0..a85cb145 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -311,8 +311,12 @@ class Statistics { AND a.id = ? GROUP BY HOUR(time) "); - if ($this->checkStmt($stmt) && $stmt->bind_param("i", $account_id) && $stmt->execute() && $result = $stmt->get_result()) - return $this->memcache->setCache(__FUNCTION__ . $account_id, $result->fetch_all(MYSQLI_ASSOC), 3600); + if ($this->checkStmt($stmt) && $stmt->bind_param("i", $account_id) && $stmt->execute() && $result = $stmt->get_result()) { + while ($row = $result->fetch_assoc()) { + $aData[$row['hour']] = $row['hashrate']; + } + return $this->memcache->setCache(__FUNCTION__ . $account_id, $aData, 3600); + } // Catchall $this->debug->append("Failed to fetch hourly hashrate: " . $this->mysqli->error); return false; diff --git a/public/include/pages/statistics/user.inc.php b/public/include/pages/statistics/user.inc.php index 2a713925..2b0b0ed9 100644 --- a/public/include/pages/statistics/user.inc.php +++ b/public/include/pages/statistics/user.inc.php @@ -8,7 +8,6 @@ $aHourlyHashRates = $statistics->getHourlyHashrateByAccount($_SESSION['USERDATA' // Propagate content our template $smarty->assign("YOURHASHRATES", $aHourlyHashRates); -$smarty->assign("DIFFICULTY", $dDifficulty); if ($_SESSION['AUTHENTICATED']) { $smarty->assign("CONTENT", "default.tpl"); diff --git a/public/templates/mmcFE/statistics/user/default.tpl b/public/templates/mmcFE/statistics/user/default.tpl index dee8180e..201c783c 100644 --- a/public/templates/mmcFE/statistics/user/default.tpl +++ b/public/templates/mmcFE/statistics/user/default.tpl @@ -1,23 +1,33 @@ {include file="global/block_header.tpl" BLOCK_HEADER="Your Average Hourly Hash Rate" BUTTONS=array(mine,pool,both)} +{if is_array($YOURHASHRATES)}
| -{section hashrate $YOURHASHRATES} - | {$YOURHASHRATES[hashrate].hour} | -{/section} +{for $i=date('G', time() + 60 * 60) to 23} +{$i} | +{/for} +{for $i=0 to date('G')} +{$i} | +{/for}
|---|---|---|---|
| {$GLOBAL.USERDATA.username} | -{section hashrate $YOURHASHRATES} -{$YOURHASHRATES[hashrate].hashrate} | -{/section} +{for $i=date('G', time() + 60 * 60) to 23} +{$YOURHASHRATES.$i|default:"0"} | +{/for} +{for $i=0 to date('G')} +{$YOURHASHRATES.$i|default:"0"} | +{/for}