diff --git a/public/include/classes/worker.class.php b/public/include/classes/worker.class.php
index 889c8fa1..4e88a89f 100644
--- a/public/include/classes/worker.class.php
+++ b/public/include/classes/worker.class.php
@@ -136,39 +136,39 @@ class Worker {
* @param account_id int User ID
* @return mixed array Workers and their settings or false
**/
- public function getWorkers($account_id) {
+ public function getWorkers($account_id, $interval) {
$this->debug->append("STA " . __METHOD__, 4);
$stmt = $this->mysqli->prepare("
SELECT id, username, password, monitor,
- ( SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS count_all,
- ( SELECT COUNT(id) FROM " . $this->share->getArchiveTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)) AS count_all_archive,
+ ( SELECT COUNT(id) FROM " . $this->share->getTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)) AS count_all,
+ ( SELECT COUNT(id) FROM " . $this->share->getArchiveTableName() . " WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)) AS count_all_archive,
(
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() . "
WHERE
username = w.username
- AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ AND time > DATE_SUB(now(), INTERVAL ? SECOND)
) + (
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() . "
WHERE
username = w.username
- AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ AND time > DATE_SUB(now(), INTERVAL ? SECOND)
) AS hashrate,
(
SELECT IFNULL(ROUND(SUM(IF(difficulty=0, pow(2, (" . $this->config['difficulty'] . " - 16)), difficulty)) / count_all, 2), 0)
FROM " . $this->share->getTableName() . "
- WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ 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)) / count_all_archive, 2), 0)
FROM " . $this->share->getArchiveTableName() . "
- WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL 10 MINUTE)
+ WHERE username = w.username AND time > DATE_SUB(now(), INTERVAL ? SECOND)
) 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())
+ if ($this->checkStmt($stmt) && $stmt->bind_param('iiiiiiiii', $interval, $interval, $interval, $interval, $interval, $interval, $interval, $interval, $account_id) && $stmt->execute() && $result = $stmt->get_result())
return $result->fetch_all(MYSQLI_ASSOC);
// Catchall
$this->setErrorMessage('Failed to fetch workers for your account');
diff --git a/public/include/pages/api/getdashboarddata.inc.php b/public/include/pages/api/getdashboarddata.inc.php
index 732eb65a..b0accee1 100644
--- a/public/include/pages/api/getdashboarddata.inc.php
+++ b/public/include/pages/api/getdashboarddata.inc.php
@@ -44,10 +44,16 @@ $dPersonalHashrateAdjusted = $dPersonalHashrate * $dPersonalHashrateModifier;
$dPoolHashrateAdjusted = $dPoolHashrate * $dPoolHashrateModifier;
$dNetworkHashrateAdjusted = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier;
+// Worker information
+$aWorkers = $worker->getWorkers($user_id, $interval);
+
// Output JSON format
$data = array(
'raw' => array( 'personal' => array( 'hashrate' => $dPersonalHashrate ), 'pool' => array( 'hashrate' => $dPoolHashrate ), 'network' => array( 'hashrate' => $dNetworkHashrate / 1000 ) ),
- 'personal' => array ( 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate, 'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid']), 'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates),
+ 'personal' => array (
+ 'hashrate' => $dPersonalHashrateAdjusted, 'sharerate' => $dPersonalSharerate,
+ 'shares' => array('valid' => $aUserRoundShares['valid'], 'invalid' => $aUserRoundShares['invalid']),
+ 'balance' => $transaction->getBalance($user_id), 'estimates' => $aEstimates, 'workers' => $aWorkers),
'pool' => array( 'hashrate' => $dPoolHashrateAdjusted, 'shares' => $aRoundShares ),
'network' => array( 'hashrate' => $dNetworkHashrateAdjusted, 'difficulty' => $dDifficulty, 'block' => $iBlock ),
);
diff --git a/public/templates/mpos/dashboard/account_data.tpl b/public/templates/mpos/dashboard/account_data.tpl
index 2ffd0822..12e62f2a 100644
--- a/public/templates/mpos/dashboard/account_data.tpl
+++ b/public/templates/mpos/dashboard/account_data.tpl
@@ -12,7 +12,7 @@
Please consider donating some of your mined coins to the pool operator.
{/if}
- {$GLOBAL.config.currency} Account Balance
+ {$GLOBAL.config.currency} Account Balance
| Confirmed |
|
diff --git a/public/templates/mpos/dashboard/default.tpl b/public/templates/mpos/dashboard/default.tpl
index 2869f8b4..d2ac6e8e 100644
--- a/public/templates/mpos/dashboard/default.tpl
+++ b/public/templates/mpos/dashboard/default.tpl
@@ -2,7 +2,8 @@
{assign var=payout_system value=$GLOBAL.config.payout_system}
{include file="dashboard/overview.tpl"}
{include file="dashboard/round_data.tpl"}
- {include file="dashboard/account_data.tpl"}
{include file="dashboard/default_$payout_system.tpl"}
+ {include file="dashboard/account_data.tpl"}
+ {include file="dashboard/workers.tpl"}
{include file="dashboard/js.tpl"}
{/if}
diff --git a/public/templates/mpos/dashboard/default_pplns.tpl b/public/templates/mpos/dashboard/default_pplns.tpl
index d4249542..d47ea946 100644
--- a/public/templates/mpos/dashboard/default_pplns.tpl
+++ b/public/templates/mpos/dashboard/default_pplns.tpl
@@ -1,23 +1,16 @@
-
+
-
+
| PPLNS Target |
- {$GLOBAL.pplns.target|number_format} |
-
-
- | Your Stats |
-
-
- | Hashrate |
- {$GLOBAL.userdata.hashrate|number_format} KH/s |
-
-
- | Share Rate |
- {$GLOBAL.userdata.sharerate|number_format:"2"} S/s |
+ {$GLOBAL.pplns.target|number_format} |
+
+
+
+
Round Shares  |
@@ -37,6 +30,10 @@
Your Invalid |
{$GLOBAL.userdata.shares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} |
+
+
+
+
| {$GLOBAL.config.currency} Round Estimate |
@@ -56,9 +53,6 @@
Payout |
{$GLOBAL.userdata.est_payout|number_format:"3"} |
- | {$GLOBAL.config.currency} Account Balance |
- | Confirmed | {$GLOBAL.userdata.balance.confirmed|default:"0"} |
- | Unconfirmed | {$GLOBAL.userdata.balance.unconfirmed|default:"0"} |
diff --git a/public/templates/mpos/dashboard/default_pps.tpl b/public/templates/mpos/dashboard/default_pps.tpl
index 3f62d390..7223765d 100644
--- a/public/templates/mpos/dashboard/default_pps.tpl
+++ b/public/templates/mpos/dashboard/default_pps.tpl
@@ -1,62 +1,54 @@
-
-
-
-
-
-
- | Your Stats |
-
-
- | Hashrate |
- {$GLOBAL.userdata.hashrate|number_format} KH/s |
-
-
- | Share Rate |
- {$GLOBAL.userdata.sharerate|number_format:"2"} S/s |
-
-
- | PPS Value |
- {$GLOBAL.ppsvalue} |
-
-
- Round Shares  |
-
-
- | Pool Valid |
- {$GLOBAL.roundshares.valid|number_format} |
-
-
- | Your Valid |
- {$GLOBAL.userdata.shares.valid|number_format} |
-
-
- | Pool Invalid |
- {$GLOBAL.roundshares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.roundshares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} |
-
-
- | Your Invalid |
- {$GLOBAL.userdata.shares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} |
-
- | |
- | {$GLOBAL.config.currency} Estimates |
-
- | in 24 hours |
- {($GLOBAL.userdata.sharerate * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
-
-
- | in 7 days |
- {($GLOBAL.userdata.sharerate * 7 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
-
-
- | in 14 days |
- {($GLOBAL.userdata.sharerate * 14 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
-
- | |
- | {$GLOBAL.config.currency} Account Balance |
- | Confirmed | {$GLOBAL.userdata.balance.confirmed|default:"0"} |
- | Unconfirmed | {$GLOBAL.userdata.balance.unconfirmed|default:"0"} |
-
-
-
-
+
+
+
+
+
+
+ | PPS Value |
+ {$GLOBAL.ppsvalue} |
+
+
+
+
+
+
+ Round Shares  |
+
+
+ | Pool Valid |
+ {$GLOBAL.roundshares.valid|number_format} |
+
+
+ | Your Valid |
+ {$GLOBAL.userdata.shares.valid|number_format} |
+
+
+ | Pool Invalid |
+ {$GLOBAL.roundshares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.roundshares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} |
+
+
+ | Your Invalid |
+ {$GLOBAL.userdata.shares.invalid|number_format}{if $GLOBAL.roundshares.valid > 0} ({($GLOBAL.userdata.shares.invalid / ($GLOBAL.roundshares.valid + $GLOBAL.roundshares.invalid) * 100)|number_format:"2"}%){/if} |
+
+
+
+
+
+ | {$GLOBAL.config.currency} Estimates |
+
+ | in 24 hours |
+ {($GLOBAL.userdata.sharerate * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
+
+
+ | in 7 days |
+ {($GLOBAL.userdata.sharerate * 7 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
+
+
+ | in 14 days |
+ {($GLOBAL.userdata.sharerate * 14 * 24 * 60 * 60 * $GLOBAL.ppsvalue)|number_format:"8"} |
+
+
+
+
+
diff --git a/public/templates/mpos/dashboard/js.tpl b/public/templates/mpos/dashboard/js.tpl
index cf55f3fc..be5aeb52 100644
--- a/public/templates/mpos/dashboard/js.tpl
+++ b/public/templates/mpos/dashboard/js.tpl
@@ -137,6 +137,21 @@ $(document).ready(function(){
$('#b-unconfirmed').html(data.getdashboarddata.data.personal.balance.unconfirmed);
}
+ // Refresh worker information
+ function refreshWorkerData(data) {
+ data = data.getdashboarddata.data;
+ workers = data.personal.workers;
+ length = workers.length;
+ $('#b-workers').html('');
+ for (var i = j = 0; i < length; i++) {
+ if (workers[i].hashrate > 0) {
+ j++;
+ $('#b-workers').append('| ' + workers[i].username + ' | ' + workers[i].hashrate + ' | ' + workers[i].difficulty + ' |
');
+ }
+ }
+ if (j == 0) { $('#b-workers').html('| No active workers |
'); }
+ }
+
// Our worker process to keep gauges and graph updated
(function worker() {
$.ajax({
@@ -145,6 +160,7 @@ $(document).ready(function(){
success: function(data) {
refreshInformation(data);
refreshStaticData(data);
+ refreshWorkerData(data);
},
complete: function() {
setTimeout(worker, {/literal}{($GLOBAL.config.statistics_ajax_refresh_interval * 1000)|default:"10000"}{literal})
diff --git a/public/templates/mpos/dashboard/workers.tpl b/public/templates/mpos/dashboard/workers.tpl
new file mode 100644
index 00000000..c3673f79
--- /dev/null
+++ b/public/templates/mpos/dashboard/workers.tpl
@@ -0,0 +1,16 @@
+
+ Active Worker Information
+
+
+
+ | Worker |
+ Hashrate |
+ Difficulty |
+
+
+
+ Loading worker information |
+
+
+
+
diff --git a/public/templates/mpos/master.tpl b/public/templates/mpos/master.tpl
index 95e9c828..e32f95e9 100644
--- a/public/templates/mpos/master.tpl
+++ b/public/templates/mpos/master.tpl
@@ -20,7 +20,6 @@
-