Merge pull request #134 from TheSerapher/issue-133

Properly display both shares and hashrates
This commit is contained in:
Sebastian Grewe 2013-06-07 00:05:40 -07:00
commit 207f59dc80
2 changed files with 3 additions and 4 deletions

View File

@ -189,14 +189,12 @@ class Statistics {
a.username AS username,
a.donate_percent AS donate_percent,
a.email AS email,
ROUND(COUNT(s.id) * POW(2," . $this->config['difficulty'] . ") / 600 / 1000,2) AS hashrate,
( SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE a.username = SUBSTRING_INDEX( s.username, '.', 1 ) ) AS shares
COUNT(s.id) AS shares
FROM " . $this->user->getTableName() . " AS a
LEFT JOIN " . $this->share->getTableName() . " AS s
ON a.username = SUBSTRING_INDEX( s.username, '.', 1 )
WHERE
a.username LIKE ?
AND s.time > DATE_SUB(now(), INTERVAL 10 MINUTE)
a.username LIKE ?
GROUP BY username
ORDER BY username
");

View File

@ -21,6 +21,7 @@ if ($_POST['query']) {
// Query against the stats table? Currently cached though.
foreach ($aUsers as $iKey => $aUser) {
$aUser['balance'] = $transaction->getBalance($aUser['id']);
$aUser['hashrate'] = $statistics->getUserHashrate($aUser['id']);
$aUser['payout']['est_block'] = round(( (int)$aUser['shares'] / (int)$aRoundShares['valid'] ) * (int)$config['reward'], 3);
$aUser['payout']['est_fee'] = round(($config['fees'] / 100) * $aUser['payout']['est_block'], 3);
$aUser['payout']['est_donation'] = round((( $aUser['donate_percent'] / 100) * ($aUser['payout']['est_block'] - $aUser['payout']['est_fee'])), 3);