[CHANGE] Shares/s to diff1 shares/s

This commit is contained in:
Sebastian Grewe 2014-07-17 09:37:40 +02:00
parent 2c773fca42
commit feb9586774

View File

@ -261,12 +261,12 @@ class Statistics extends Base {
SELECT SELECT
( (
( (
SELECT ROUND(COUNT(id) / ?, 2) AS sharerate SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
FROM " . $this->share->getTableName() . " FROM " . $this->share->getTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y' AND our_result = 'Y'
) + ( ) + (
SELECT ROUND(COUNT(id) / ?, 2) AS sharerate SELECT ROUND(SUM(difficulty) / ?, 2) AS sharerate
FROM " . $this->share->getArchiveTableName() . " FROM " . $this->share->getArchiveTableName() . "
WHERE time > DATE_SUB(now(), INTERVAL ? SECOND) WHERE time > DATE_SUB(now(), INTERVAL ? SECOND)
AND our_result = 'Y' AND our_result = 'Y'
@ -470,7 +470,7 @@ class Statistics extends Base {
a.username AS account, a.username AS account,
COUNT(DISTINCT t1.username) AS workers, COUNT(DISTINCT t1.username) AS workers,
IFNULL(SUM(t1.difficulty), 0) AS shares, IFNULL(SUM(t1.difficulty), 0) AS shares,
ROUND(COUNT(t1.id) / ?, 2) AS sharerate, ROUND(SUM(t1.difficulty) / ?, 2) AS sharerate,
IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff IFNULL(AVG(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 0) AS avgsharediff
FROM ( FROM (
SELECT SELECT
@ -558,7 +558,7 @@ class Statistics extends Base {
* Get Shares per x interval by user * Get Shares per x interval by user
* @param username string username * @param username string username
* @param $account_id int account id * @param $account_id int account id
* @return data integer Current Sharerate in shares/s * @return data integer Current Sharerate in diff1 shares/s
**/ **/
public function getUserMiningStats($username, $account_id=NULL, $interval=180) { public function getUserMiningStats($username, $account_id=NULL, $interval=180) {
$this->debug->append("STA " . __METHOD__, 4); $this->debug->append("STA " . __METHOD__, 4);
@ -575,7 +575,7 @@ class Statistics extends Base {
if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data; if ($this->getGetCache() && $data = $this->memcache->get(__FUNCTION__ . $account_id)) return $data;
$stmt = $this->mysqli->prepare(" $stmt = $this->mysqli->prepare("
SELECT SELECT
IFNULL(COUNT(*) / ?, 0) AS sharerate, IFNULL(SUM(difficulty) / ?, 0) AS sharerate,
IFNULL(SUM(difficulty), 0) AS shares, IFNULL(SUM(difficulty), 0) AS shares,
IFNULL(AVG(difficulty), 0) AS avgsharediff IFNULL(AVG(difficulty), 0) AS avgsharediff
FROM ( FROM (