[FIX] getUserShareDifficulty must return 0 on NULL

This commit is contained in:
Sebastian Grewe 2013-10-25 14:48:36 +02:00
parent 6fd04fc838
commit a545362ba5

View File

@ -398,7 +398,7 @@ class Statistics {
if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data;
$stmt = $this->mysqli->prepare("
SELECT
AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) AS avgsharediff,
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff,
COUNT(s.id) AS total
FROM " . $this->share->getTableName() . " AS s JOIN " . $this->user->getTableName() . " AS a
ON a.username = SUBSTRING_INDEX( s.username, '.', 1 )