diff --git a/public/include/classes/statistics.class.php b/public/include/classes/statistics.class.php index 1b75da35..7d7b8af1 100644 --- a/public/include/classes/statistics.class.php +++ b/public/include/classes/statistics.class.php @@ -568,7 +568,8 @@ class Statistics extends Base { FROM " . $this->share->getTableName() . " AS s WHERE username = '?.%' AND time > DATE_SUB(now(), INTERVAL ? SECOND) - AND our_result = 'Y'); + AND our_result = 'Y' + "); if ($this->checkStmt($stmt) && $stmt->bind_param("ii", $username, $interval) && $stmt->execute() && $result = $stmt->get_result() ) return $this->memcache->setCache(__FUNCTION__ . $username, $result->fetch_object()->avgsharediff); return $this->sqlError(); diff --git a/public/include/pages/api/getdashboarddata.inc.php b/public/include/pages/api/getdashboarddata.inc.php index 69d4ed35..3ca71365 100644 --- a/public/include/pages/api/getdashboarddata.inc.php +++ b/public/include/pages/api/getdashboarddata.inc.php @@ -45,13 +45,13 @@ if ( ! $dNetworkHashrateModifier = $setting->getValue('statistics_network_hashra $statistics->setGetCache(false); $dPoolHashrate = $statistics->getCurrentHashrate($interval); if ($dPoolHashrate > $dNetworkHashrate) $dNetworkHashrate = $dPoolHashrate; -$dPersonalHashrate = $statistics->getUserHashrate($username, $interval); -$dPersonalSharerate = $statistics->getUserSharerate($username, $interval); -$dPersonalShareDifficulty = $statistics->getUserShareDifficulty($username, $interval); +$dPersonalHashrate = $statistics->getUserHashrate($username, $user_id, $interval); +$dPersonalSharerate = $statistics->getUserSharerate($username, $user_id, $interval); +$dPersonalShareDifficulty = $statistics->getUserShareDifficulty($username, $user_id, $interval); $statistics->setGetCache(true); // Use caches for this one -$aUserRoundShares = $statistics->getUserShares($username); +$aUserRoundShares = $statistics->getUserShares($username, $user_id); $aRoundShares = $statistics->getRoundShares(); if ($config['payout_system'] != 'pps') { diff --git a/public/include/pages/api/getusersharerate.inc.php b/public/include/pages/api/getusersharerate.inc.php index a51db57a..3549c0f4 100644 --- a/public/include/pages/api/getusersharerate.inc.php +++ b/public/include/pages/api/getusersharerate.inc.php @@ -15,7 +15,7 @@ if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interva // Gather un-cached data $statistics->setGetCache(false); -$sharerate = $statistics->getUserSharerate($username, $interval); +$sharerate = $statistics->getUserSharerate($username, $user_id, $interval); $statistics->setGetCache(true); // Output JSON format diff --git a/public/include/pages/api/getuserstatus.inc.php b/public/include/pages/api/getuserstatus.inc.php index 2a717cd6..23ef53c7 100644 --- a/public/include/pages/api/getuserstatus.inc.php +++ b/public/include/pages/api/getuserstatus.inc.php @@ -15,9 +15,9 @@ $aTransactionSummary = $transaction->getTransactionSummary($user_id); // Output JSON format $data = array( 'username' => $username, - 'shares' => $statistics->getUserShares($username), - 'hashrate' => $statistics->getUserHashrate($username), - 'sharerate' => $statistics->getUserSharerate($username) + 'shares' => $statistics->getUserShares($username, $user_id), + 'hashrate' => $statistics->getUserHashrate($username, $user_id), + 'sharerate' => $statistics->getUserSharerate($username, $user_id) ); echo $api->get_json($data); diff --git a/public/include/smarty_globals.inc.php b/public/include/smarty_globals.inc.php index e564b252..e3637cd3 100644 --- a/public/include/smarty_globals.inc.php +++ b/public/include/smarty_globals.inc.php @@ -129,10 +129,10 @@ if (@$_SESSION['USERDATA']['id']) { $aGlobal['userdata']['balance'] = $transaction->getBalance($_SESSION['USERDATA']['id']); // Other userdata that we can cache savely - $aGlobal['userdata']['shares'] = $statistics->getUserShares($_SESSION['USERDATA']['username']); - $aGlobal['userdata']['rawhashrate'] = $statistics->getUserHashrate($_SESSION['USERDATA']['username']); + $aGlobal['userdata']['shares'] = $statistics->getUserShares($_SESSION['USERDATA']['username'], $_SESSION['USERDATA']['id']); + $aGlobal['userdata']['rawhashrate'] = $statistics->getUserHashrate($_SESSION['USERDATA']['username'], $_SESSION['USERDATA']['id']); $aGlobal['userdata']['hashrate'] = $aGlobal['userdata']['rawhashrate'] * $dPersonalHashrateModifier; - $aGlobal['userdata']['sharerate'] = $statistics->getUserSharerate($_SESSION['USERDATA']['username']); + $aGlobal['userdata']['sharerate'] = $statistics->getUserSharerate($_SESSION['USERDATA']['username'], $_SESSION['USERDATA']['id']); switch ($config['payout_system']) { case 'prop':