diff --git a/public/include/classes/roundstats.class.php b/public/include/classes/roundstats.class.php
index 412defaf..45dbb7ea 100644
--- a/public/include/classes/roundstats.class.php
+++ b/public/include/classes/roundstats.class.php
@@ -113,6 +113,7 @@ class RoundStats {
public function getRoundStatsForAccounts($iHeight=0) {
$stmt = $this->mysqli->prepare("
SELECT
+ a.id,
a.username,
a.is_anonymous,
s.valid,
@@ -124,8 +125,12 @@ class RoundStats {
GROUP BY username ASC
ORDER BY valid DESC
");
- if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result())
- return $result->fetch_all(MYSQLI_ASSOC);
+ if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result()) {
+ while ($row = $result->fetch_assoc()) {
+ $aData[$row['id']] = $row;
+ }
+ return $aData;
+ }
return false;
}
@@ -179,6 +184,7 @@ class RoundStats {
$stmt = $this->mysqli->prepare("
SELECT
t.id AS id,
+ a.id AS uid,
a.username AS username,
a.is_anonymous,
t.type AS type,
diff --git a/public/include/pages/statistics/round.inc.php b/public/include/pages/statistics/round.inc.php
index e81db3fc..4e7288d5 100644
--- a/public/include/pages/statistics/round.inc.php
+++ b/public/include/pages/statistics/round.inc.php
@@ -26,38 +26,26 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$_REQUEST['height'] = $iHeight;
$iPPLNSShares = 0;
- $aSharesData = array();
$aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iHeight);
$aRoundShareStats = $roundstats->getRoundStatsForAccounts($iHeight);
+ $aUserRoundTransactions = $roundstats->getAllRoundTransactions($iHeight);
if ($config['payout_system'] == 'pplns') {
- $aUserRoundTransactions = $roundstats->getAllRoundTransactions($iHeight);
- foreach($aRoundShareStats as $key => $aData) {
- $aSharesData[$aData['username']] = $aData;
- }
$aPPLNSRoundShares = $roundstats->getPPLNSRoundStatsForAccounts($iHeight);
- foreach($aPPLNSRoundShares as $key => $aData) {
+ foreach($aPPLNSRoundShares as $aData) {
$iPPLNSShares += $aData['pplns_valid'];
}
$block_avg = $block->getAvgBlockShares($iHeight, $config['pplns']['blockavg']['blockcount']);
- } else if ($config['payout_system'] == 'prop') {
- $aUserRoundTransactions = $roundstats->getAllRoundTransactions($iHeight);
+ $smarty->assign('PPLNSROUNDSHARES', $aPPLNSRoundShares);
+ $smarty->assign("PPLNSSHARES", $iPPLNSShares);
+ $smarty->assign("BLOCKAVGCOUNT", $config['pplns']['blockavg']['blockcount']);
+ $smarty->assign("BLOCKAVERAGE", $block_avg );
}
// Propagate content our template
$smarty->assign('BLOCKDETAILS', $aDetailsForBlockHeight);
$smarty->assign('ROUNDSHARES', $aRoundShareStats);
-
- if ($config['payout_system'] == 'pplns') {
- $smarty->assign('SHARESDATA', $aSharesData);
- $smarty->assign('PPLNSROUNDSHARES', $aPPLNSRoundShares);
- $smarty->assign("PPLNSSHARES", $iPPLNSShares);
- $smarty->assign("BLOCKAVGCOUNT", $config['pplns']['blockavg']['blockcount']);
- $smarty->assign("BLOCKAVERAGE", $block_avg );
- $smarty->assign("ROUNDTRANSACTIONS", $aUserRoundTransactions);
- } else if ($config['payout_system'] == 'prop') {
- $smarty->assign("ROUNDTRANSACTIONS", $aUserRoundTransactions);
- }
+ $smarty->assign("ROUNDTRANSACTIONS", $aUserRoundTransactions);
} else {
$debug->append('Using cached page', 3);
}
diff --git a/public/templates/mpos/statistics/round/pplns_transactions.tpl b/public/templates/mpos/statistics/round/pplns_transactions.tpl
index 6b46f1ae..3487bc15 100644
--- a/public/templates/mpos/statistics/round/pplns_transactions.tpl
+++ b/public/templates/mpos/statistics/round/pplns_transactions.tpl
@@ -17,11 +17,11 @@
{section txs $ROUNDTRANSACTIONS}
| {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} |
- {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid|number_format} |
- {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid)|number_format:"2"}{else}0.00{/if} |
+ {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format} |
+ {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid > 0 }{(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|number_format:"2"}{else}0.00{/if} |
{$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"} |
{if $PPLNSROUNDSHARES[txs].pplns_valid > 0 }{(( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)|number_format:"2"|default:"0"}{else}0{/if} |
- {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid > 0 && $PPLNSROUNDSHARES[txs].pplns_valid > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}
+ | {if $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid > 0 && $PPLNSROUNDSHARES[txs].pplns_valid > 0}{math assign="percentage1" equation=(100 / ((( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid) / (( 100 / $PPLNSSHARES) * $PPLNSROUNDSHARES[txs].pplns_valid)))}{else if $PPLNSROUNDSHARES[txs].pplns_valid == 0}{assign var=percentage1 value=0}{else}{assign var=percentage1 value=100}{/if}
{$percentage1|number_format:"2"} |
{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} |
{assign var=percentage1 value=0}
diff --git a/public/templates/mpos/statistics/round/round_shares.tpl b/public/templates/mpos/statistics/round/round_shares.tpl
index 1cddbc6e..3a58e846 100644
--- a/public/templates/mpos/statistics/round/round_shares.tpl
+++ b/public/templates/mpos/statistics/round/round_shares.tpl
@@ -13,15 +13,15 @@
{assign var=rank value=1}
{assign var=listed value=0}
-{section contrib $ROUNDSHARES}
-
+{foreach key=id item=data from=$ROUNDSHARES}
+
| {$rank++} |
- {if $ROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDSHARES[contrib].username|escape}{/if} |
- {$ROUNDSHARES[contrib].valid|number_format} |
- {$ROUNDSHARES[contrib].invalid|number_format} |
- {if $ROUNDSHARES[contrib].invalid > 0 }{($ROUNDSHARES[contrib].invalid / $ROUNDSHARES[contrib].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} |
+ {if $data.is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$data.username|escape}{/if} |
+ {$data.valid|number_format} |
+ {$data.invalid|number_format} |
+ {if $data.invalid > 0 }{($data.invalid / $data.valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} |
-{/section}
+{/foreach}
diff --git a/public/templates/mpos/statistics/round/round_transactions.tpl b/public/templates/mpos/statistics/round/round_transactions.tpl
index f1cb8010..1ab76f97 100644
--- a/public/templates/mpos/statistics/round/round_transactions.tpl
+++ b/public/templates/mpos/statistics/round/round_transactions.tpl
@@ -5,6 +5,7 @@
| User Name |
Type |
+ Round Shares |
Round % |
Amount |
@@ -14,7 +15,8 @@
| {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} |
{$ROUNDTRANSACTIONS[txs].type|default:""} |
- {(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[txs].valid)|default:"0"|number_format:"2"} |
+ {$ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid|number_format} |
+ {(( 100 / $BLOCKDETAILS.shares) * $ROUNDSHARES[$ROUNDTRANSACTIONS[txs].uid].valid)|default:"0"|number_format:"2"} |
{$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} |
{/section}