adding per-worker difficulty display

This commit is contained in:
Sebastian Grewe 2013-08-20 16:50:40 +02:00
parent 7769550f89
commit 96066993ac
3 changed files with 22 additions and 10 deletions

View File

@ -136,14 +136,23 @@ class Worker {
WHERE
username = w.username
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
) + (
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
FROM " . $this->share->getArchiveTableName() . "
WHERE
username = w.username
AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
) AS hashrate
) AS hashrate,
(
SELECT IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) / COUNT(id), 2), 0), 0)
FROM " . $this->share->getTableName() . "
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
) + (
SELECT IFNULL(IF(our_result='Y', ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) / COUNT(id), 2), 0), 0)
FROM " . $this->share->getArchiveTableName() . "
WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
) AS difficulty
FROM $this->table AS w
WHERE account_id = ?");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $account_id) && $stmt->execute() && $result = $stmt->get_result())

View File

@ -7,13 +7,13 @@
<table border="0" cellpadding="3" cellspacing="3">
<tbody>
<tr>
<td>Worker Name</td>
<td>Password</td>
<td class="center">Active</td>
{if $GLOBAL.config.disable_notifications != 1}<td class="center">Monitor</td>{/if}
<td class="right">Khash/s</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<th>Worker Name</th>
<th>Password</th>
<th class="center">Active</th>
{if $GLOBAL.config.disable_notifications != 1}<th class="center">Monitor</th>{/if}
<th class="right">Khash/s</th>
<th class="right">Difficulty</th>
<th>Action</th>
</tr>
{nocache}
{section worker $WORKERS}
@ -29,6 +29,7 @@
</td>
{/if}
<td class="right">{$WORKERS[worker].hashrate|number_format}</td>
<td class="right">{$WORKERS[worker].difficulty|number_format:"2"}</td>
<td align="right"><a href="{$smarty.server.PHP_SELF}?page={$smarty.request.page|escape}&action={$smarty.request.action|escape}&do=delete&id={$WORKERS[worker].id|escape}"><button style="padding:5px" type="button">Delete</button></a></td>
</tr>
{/section}

View File

@ -4,6 +4,7 @@
<th align="left">Worker Name</th>
<th align="center">Active</th>
<th align="right">Khash/s</th>
<th align="right">Difficulty</th>
</tr>
{section worker $WORKERS}
{assign var="username" value="."|escape|explode:$WORKERS[worker].username:2}
@ -11,6 +12,7 @@
<td align="left"{if $WORKERS[worker].active} style="color: orange"{/if}>{$username.0|escape}.{$username.1|escape}</td>
<td align="center"><img src="{$PATH}/images/{if $WORKERS[worker].hashrate > 0}success{else}error{/if}.gif" /></td>
<td align="right">{$WORKERS[worker].hashrate|number_format}</td>
<td class="right">{$WORKERS[worker].hashrate|number_format}</td>
</tr>
{/section}
</tbody>