[IMPROVED] User real account name for contributor lists

This commit is contained in:
Sebastian Grewe 2013-10-23 07:36:29 +02:00
parent af533e35b6
commit a97fd7341f

View File

@ -196,7 +196,6 @@ class Statistics {
$data['share_id'] = 0; $data['share_id'] = 0;
$data['data'] = array(); $data['data'] = array();
} }
$data['last_update'] = time();
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
ROUND(IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS valid, ROUND(IFNULL(SUM(IF(our_result='Y', IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty), 0)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS valid,
@ -417,10 +416,10 @@ class Statistics {
// No cached data, fallback to SQL and cache in local cache // No cached data, fallback to SQL and cache in local cache
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
a.username AS account,
a.donate_percent AS donate_percent, a.donate_percent AS donate_percent,
a.is_anonymous AS is_anonymous, a.is_anonymous AS is_anonymous,
ROUND(IFNULL(SUM(IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS shares, ROUND(IFNULL(SUM(IF(s.difficulty=0, POW(2, (" . $this->config['difficulty'] . " - 16)), s.difficulty)), 0) / POW(2, (" . $this->config['difficulty'] . " - 16)), 0) AS shares
SUBSTRING_INDEX( s.username, '.', 1 ) AS account
FROM " . $this->share->getTableName() . " AS s FROM " . $this->share->getTableName() . " AS s
LEFT JOIN " . $this->user->getTableName() . " AS a LEFT JOIN " . $this->user->getTableName() . " AS a
ON SUBSTRING_INDEX( s.username, '.', 1 ) = a.username ON SUBSTRING_INDEX( s.username, '.', 1 ) = a.username
@ -437,10 +436,10 @@ class Statistics {
case 'hashes': case 'hashes':
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
a.username AS account,
a.donate_percent AS donate_percent, a.donate_percent AS donate_percent,
a.is_anonymous AS is_anonymous, a.is_anonymous AS is_anonymous,
IFNULL(ROUND(SUM(t1.difficulty) * 65536/600/1000, 2), 0) AS hashrate, IFNULL(ROUND(SUM(t1.difficulty) * 65536 / 600 / 1000, 2), 0) AS hashrate
SUBSTRING_INDEX( t1.username, '.', 1 ) AS account
FROM FROM
( (
SELECT IFNULL(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty), 0) AS difficulty, username FROM " . $this->share->getTableName() . " WHERE time > DATE_SUB(now(), INTERVAL 10 MINUTE) AND our_result = 'Y' SELECT IFNULL(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty), 0) AS difficulty, username FROM " . $this->share->getTableName() . " WHERE time > DATE_SUB(now(), INTERVAL 10 MINUTE) AND our_result = 'Y'