Admin poolworkers average difficulty fixes
This commit is contained in:
parent
8becd60a6d
commit
4f3503bbb1
@ -181,28 +181,46 @@ class Worker {
|
|||||||
* @param limit int
|
* @param limit int
|
||||||
* @return mixed array Workers and their settings or false
|
* @return mixed array Workers and their settings or false
|
||||||
**/
|
**/
|
||||||
public function getAllWorkers($iLimit=0) {
|
public function getAllWorkers($iLimit=0, $interval=600) {
|
||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$stmt = $this->mysqli->prepare("
|
$stmt = $this->mysqli->prepare("
|
||||||
SELECT id, username, password, monitor, difficulty,
|
SELECT id, username, password, monitor,
|
||||||
|
IFNULL(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty), 0) AS difficulty,
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
|
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / ? / 1000), 0), 0) AS hashrate
|
||||||
FROM " . $this->share->getTableName() . "
|
FROM " . $this->share->getTableName() . "
|
||||||
WHERE
|
WHERE
|
||||||
username = w.username
|
username = w.username
|
||||||
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
) + (
|
) + (
|
||||||
SELECT
|
SELECT
|
||||||
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / 600 / 1000), 0), 0) AS hashrate
|
IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) * 65536 / ? / 1000), 0), 0) AS hashrate
|
||||||
FROM " . $this->share->getArchiveTableName() . "
|
FROM " . $this->share->getArchiveTableName() . "
|
||||||
WHERE
|
WHERE
|
||||||
username = w.username
|
username = w.username
|
||||||
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
|
AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
) AS hashrate
|
) AS hashrate,
|
||||||
|
((
|
||||||
|
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 2), 0)
|
||||||
|
FROM " . $this->share->getTableName() . "
|
||||||
|
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
|
) + (
|
||||||
|
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)), 2), 0)
|
||||||
|
FROM " . $this->share->getArchiveTableName() . "
|
||||||
|
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
|
)) / ((
|
||||||
|
SELECT COUNT(id)
|
||||||
|
FROM " . $this->share->getTableName() . "
|
||||||
|
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
|
) + (
|
||||||
|
SELECT COUNT(id)
|
||||||
|
FROM " . $this->share->getArchiveTableName() . "
|
||||||
|
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
|
||||||
|
)) AS avg_difficulty
|
||||||
FROM $this->table AS w
|
FROM $this->table AS w
|
||||||
ORDER BY hashrate DESC LIMIT ?");
|
ORDER BY hashrate DESC LIMIT ?");
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iLimit) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiiiiii', $interval, $interval, $interval, $interval, $interval, $interval, $interval, $interval, $iLimit) && $stmt->execute() && $result = $stmt->get_result())
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
// Catchall
|
// Catchall
|
||||||
$this->setErrorMessage('Failed to fetch workers');
|
$this->setErrorMessage('Failed to fetch workers');
|
||||||
|
|||||||
@ -9,6 +9,7 @@
|
|||||||
{if $GLOBAL.config.disable_notifications != 1}<th class="center">Monitor</th>{/if}
|
{if $GLOBAL.config.disable_notifications != 1}<th class="center">Monitor</th>{/if}
|
||||||
<th class="right">Khash/s</th>
|
<th class="right">Khash/s</th>
|
||||||
<th class="right">Difficulty</th>
|
<th class="right">Difficulty</th>
|
||||||
|
<th class="right">Avg Difficulty</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{nocache}
|
{nocache}
|
||||||
@ -25,6 +26,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
<td class="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
<td class="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
||||||
<td class="right">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
<td class="right">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
|
<td class="right">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].avg_difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/section}
|
{/section}
|
||||||
{/nocache}
|
{/nocache}
|
||||||
|
|||||||
@ -8,7 +8,8 @@
|
|||||||
<th align="center">Active</th>
|
<th align="center">Active</th>
|
||||||
{if $GLOBAL.config.disable_notifications != 1}<th align="center">Monitor</th>{/if}
|
{if $GLOBAL.config.disable_notifications != 1}<th align="center">Monitor</th>{/if}
|
||||||
<th align="right">Khash/s</th>
|
<th align="right">Khash/s</th>
|
||||||
<th align="right" style="padding-right: 25px;">Difficulty</th>
|
<th align="right">Difficulty</th>
|
||||||
|
<th align="right" style="padding-right: 25px;">Avg Difficulty</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
{nocache}
|
{nocache}
|
||||||
@ -22,7 +23,8 @@
|
|||||||
<td align="center"><i class="icon-{if $WORKERS[worker].monitor}ok{else}cancel{/if}"></i></td>
|
<td align="center"><i class="icon-{if $WORKERS[worker].monitor}ok{else}cancel{/if}"></i></td>
|
||||||
{/if}
|
{/if}
|
||||||
<td align="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
<td align="right">{$WORKERS[worker].hashrate|number_format|default:"0"}</td>
|
||||||
<td align="right" style="padding-right: 25px;">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
<td align="right">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
|
<td align="right" style="padding-right: 25px;">{if $WORKERS[worker].hashrate > 0}{$WORKERS[worker].avg_difficulty|number_format:"2"|default:"0"}{else}0{/if}</td>
|
||||||
</tr>
|
</tr>
|
||||||
{/section}
|
{/section}
|
||||||
{/nocache}
|
{/nocache}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user