From 92e7f3e1e427c88c616a53883b43c029a3288e83 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Thu, 23 Jan 2014 16:59:12 +0100 Subject: [PATCH] [FIX] Return floats for some statistics Fixes #1540 --- 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 500d98ff..294a6bf1 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -529,7 +529,7 @@ class Statistics extends Base { AND our_result = 'Y') AS temp"); $username = $username . ".%"; if ($this->checkStmt($stmt) && $stmt->bind_param("isisi", $interval, $username, $interval, $username, $interval) && $stmt->execute() && $result = $stmt->get_result() ) - return $this->memcache->setCache(__FUNCTION__ . $account_id, $result->fetch_object()->hashrate); + return $this->memcache->setCache(__FUNCTION__ . $account_id, (float)$result->fetch_object()->hashrate); return $this->sqlError(); } @@ -577,7 +577,7 @@ class Statistics extends Base { "); $username = $username . ".%"; if ($this->checkStmt($stmt) && $stmt->bind_param("si", $username, $interval) && $stmt->execute() && $result = $stmt->get_result() ) - return $this->memcache->setCache(__FUNCTION__ . $account_id, $result->fetch_object()->avgsharediff); + return $this->memcache->setCache(__FUNCTION__ . $account_id, (float)$result->fetch_object()->avgsharediff); return $this->sqlError(); } @@ -619,7 +619,7 @@ class Statistics extends Base { ) AS temp"); $username = $username . ".%"; if ($this->checkStmt($stmt) && $stmt->bind_param("isisi", $interval, $username, $interval, $username, $interval) && $stmt->execute() && $result = $stmt->get_result() ) - return $this->memcache->setCache(__FUNCTION__ . $account_id, $result->fetch_object()->sharerate); + return $this->memcache->setCache(__FUNCTION__ . $account_id, (float)$result->fetch_object()->sharerate); return $this->sqlError(); } @@ -638,7 +638,7 @@ class Statistics extends Base { AND our_result = 'Y' AND time > DATE_SUB(now(), INTERVAL ? SECOND)"); if ($this->checkStmt($stmt) && $stmt->bind_param("si", $workername, $interval) && $stmt->execute() && $result = $stmt->get_result()) - return $this->memcache->setCache(__FUNCTION__ . $worker_id, $result->fetch_object()->hashrate); + return $this->memcache->setCache(__FUNCTION__ . $worker_id, (float)$result->fetch_object()->hashrate); return $this->sqlError(); }