From c2169576ee25019e4a10f8f6ae08b663381cfc45 Mon Sep 17 00:00:00 2001 From: obigal Date: Wed, 23 Oct 2013 00:28:24 -0400 Subject: [PATCH] round stats fixes --- public/include/classes/roundstats.class.php | 2 +- public/include/config/admin_settings.inc.php | 2 +- public/include/pages/statistics/blocks.inc.php | 6 +++--- public/include/pages/statistics/round.inc.php | 1 + public/templates/mmcFE/statistics/blocks/default.tpl | 6 +++--- .../templates/mmcFE/statistics/round/pplns_round_shares.tpl | 2 +- .../templates/mmcFE/statistics/round/pplns_transactions.tpl | 2 +- public/templates/mmcFE/statistics/round/round_shares.tpl | 2 +- .../templates/mmcFE/statistics/round/round_transactions.tpl | 2 +- public/templates/mpos/statistics/blocks/default.tpl | 6 +++--- .../templates/mpos/statistics/round/pplns_round_shares.tpl | 2 +- .../templates/mpos/statistics/round/pplns_transactions.tpl | 2 +- .../mpos/statistics/round/pplns_transactions_small.tpl | 2 +- public/templates/mpos/statistics/round/round_shares.tpl | 2 +- .../templates/mpos/statistics/round/round_transactions.tpl | 2 +- 15 files changed, 21 insertions(+), 20 deletions(-) diff --git a/public/include/classes/roundstats.class.php b/public/include/classes/roundstats.class.php index 1f5ab765..412defaf 100644 --- a/public/include/classes/roundstats.class.php +++ b/public/include/classes/roundstats.class.php @@ -124,7 +124,7 @@ 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()) + if ($this->checkStmt($stmt) && $stmt->bind_param('i', $iHeight) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); return false; } diff --git a/public/include/config/admin_settings.inc.php b/public/include/config/admin_settings.inc.php index c56bf623..b73f6c93 100644 --- a/public/include/config/admin_settings.inc.php +++ b/public/include/config/admin_settings.inc.php @@ -127,7 +127,7 @@ $aSettings['statistics'][] = array( 'display' => 'Show block average', 'type' => 'select', 'options' => array( 0 => 'No', 1 => 'Yes' ), 'default' => 0, - 'name' => 'show_block_average', 'value' => $setting->getValue('show_block_average'), + 'name' => 'statistics_show_block_average', 'value' => $setting->getValue('show_block_average'), 'tooltip' => 'Show block average in block statistics page.' ); $aSettings['statistics'][] = array( diff --git a/public/include/pages/statistics/blocks.inc.php b/public/include/pages/statistics/blocks.inc.php index ce3667cb..c21a078b 100644 --- a/public/include/pages/statistics/blocks.inc.php +++ b/public/include/pages/statistics/blocks.inc.php @@ -44,13 +44,13 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { if ($config['payout_system'] == 'pplns') { foreach($aBlocksFoundData as $key => $aData) { $aBlocksFoundData[$key]['pplns_shares'] = $roundstats->getPPLNSRoundShares($aData['height']); - if ($setting->getValue('show_block_average') && !$test) { + if ($setting->getValue('statistics_show_block_average') && !$test) { $aBlocksFoundData[$key]['block_avg'] = round($block->getAvgBlockShares($aData['height'], $config['pplns']['blockavg']['blockcount'])); $use_average = true; } } } else if ($config['payout_system'] == 'prop' || $config['payout_system'] == 'pps') { - if ($setting->getValue('show_block_average') && !$test) { + if ($setting->getValue('statistics_show_block_average') && !$test) { foreach($aBlocksFoundData as $key => $aData) { $aBlocksFoundData[$key]['block_avg'] = round($block->getAvgBlockShares($aData['height'], $config['pplns']['blockavg']['blockcount'])); $use_average = true; @@ -68,7 +68,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { } } } - +//var_dump($aBlocksFoundData); // Propagate content our template $smarty->assign("BLOCKSFOUND", $aBlocksFoundData); $smarty->assign("BLOCKLIMIT", $iLimit); diff --git a/public/include/pages/statistics/round.inc.php b/public/include/pages/statistics/round.inc.php index bcc53ebe..e81db3fc 100644 --- a/public/include/pages/statistics/round.inc.php +++ b/public/include/pages/statistics/round.inc.php @@ -26,6 +26,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $_REQUEST['height'] = $iHeight; $iPPLNSShares = 0; + $aSharesData = array(); $aDetailsForBlockHeight = $roundstats->getDetailsForBlockHeight($iHeight); $aRoundShareStats = $roundstats->getRoundStatsForAccounts($iHeight); diff --git a/public/templates/mmcFE/statistics/blocks/default.tpl b/public/templates/mmcFE/statistics/blocks/default.tpl index 1ab96c10..2d952f86 100644 --- a/public/templates/mmcFE/statistics/blocks/default.tpl +++ b/public/templates/mmcFE/statistics/blocks/default.tpl @@ -44,10 +44,10 @@ target and network difficulty and assuming a zero variance scenario. - + - + @@ -90,7 +90,7 @@ target and network difficulty and assuming a zero variance scenario. {else if $BLOCKSFOUND[block].confirmations == -1} Orphan {else}{$GLOBAL.confirmations - $BLOCKSFOUND[block].confirmations} left{/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].difficulty|number_format:"8"} {$BLOCKSFOUND[block].amount|number_format:"2"} diff --git a/public/templates/mmcFE/statistics/round/pplns_round_shares.tpl b/public/templates/mmcFE/statistics/round/pplns_round_shares.tpl index 52c47f9c..aa2d87d0 100644 --- a/public/templates/mmcFE/statistics/round/pplns_round_shares.tpl +++ b/public/templates/mmcFE/statistics/round/pplns_round_shares.tpl @@ -16,7 +16,7 @@ {section contrib $PPLNSROUNDSHARES} {$rank++} - {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|escape}{/if} + {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|escape}{/if} {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format} {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format} {if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} diff --git a/public/templates/mmcFE/statistics/round/pplns_transactions.tpl b/public/templates/mmcFE/statistics/round/pplns_transactions.tpl index 4052a24b..75ee69a7 100644 --- a/public/templates/mmcFE/statistics/round/pplns_transactions.tpl +++ b/public/templates/mmcFE/statistics/round/pplns_transactions.tpl @@ -16,7 +16,7 @@ {assign var=percentage1 value=0} {section txs $ROUNDTRANSACTIONS} - {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} + {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} {$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"} diff --git a/public/templates/mmcFE/statistics/round/round_shares.tpl b/public/templates/mmcFE/statistics/round/round_shares.tpl index 63a03a89..7ea0226b 100644 --- a/public/templates/mmcFE/statistics/round/round_shares.tpl +++ b/public/templates/mmcFE/statistics/round/round_shares.tpl @@ -15,7 +15,7 @@ {section contrib $ROUNDSHARES} {$rank++} - {if $ROUNDSHARES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDSHARES[contrib].username|escape}{/if} + {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} diff --git a/public/templates/mmcFE/statistics/round/round_transactions.tpl b/public/templates/mmcFE/statistics/round/round_transactions.tpl index 39f47697..5d7dbfc1 100644 --- a/public/templates/mmcFE/statistics/round/round_transactions.tpl +++ b/public/templates/mmcFE/statistics/round/round_transactions.tpl @@ -12,7 +12,7 @@ {section txs $ROUNDTRANSACTIONS} - {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} + {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)|number_format:"2"} {$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"} diff --git a/public/templates/mpos/statistics/blocks/default.tpl b/public/templates/mpos/statistics/blocks/default.tpl index eb87227b..e3a770a1 100644 --- a/public/templates/mpos/statistics/blocks/default.tpl +++ b/public/templates/mpos/statistics/blocks/default.tpl @@ -40,10 +40,10 @@ - + - + @@ -98,7 +98,7 @@ {$GLOBAL.confirmations - $BLOCKSFOUND[block].confirmations} left {/if} - {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} + {if $BLOCKSFOUND[block].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$BLOCKSFOUND[block].finder|default:"unknown"|escape}{/if} {$BLOCKSFOUND[block].time|date_format:"%d/%m %H:%M:%S"} {$BLOCKSFOUND[block].difficulty|number_format:"2"} {$BLOCKSFOUND[block].amount|number_format:"2"} diff --git a/public/templates/mpos/statistics/round/pplns_round_shares.tpl b/public/templates/mpos/statistics/round/pplns_round_shares.tpl index 5f299f78..68436b42 100644 --- a/public/templates/mpos/statistics/round/pplns_round_shares.tpl +++ b/public/templates/mpos/statistics/round/pplns_round_shares.tpl @@ -15,7 +15,7 @@ {section contrib $PPLNSROUNDSHARES} {$rank++} - {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|escape}{/if} + {if $PPLNSROUNDSHARES[contrib].is_anonymous|default:"0" == 1 && $GLOBAL.userdata.is_admin|default:"0" == 0}anonymous{else}{$PPLNSROUNDSHARES[contrib].username|escape}{/if} {$PPLNSROUNDSHARES[contrib].pplns_valid|number_format} {$PPLNSROUNDSHARES[contrib].pplns_invalid|number_format} {if $PPLNSROUNDSHARES[contrib].pplns_invalid > 0 && $PPLNSROUNDSHARES[contrib].pplns_valid > 0}{($PPLNSROUNDSHARES[contrib].pplns_invalid / $PPLNSROUNDSHARES[contrib].pplns_valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} diff --git a/public/templates/mpos/statistics/round/pplns_transactions.tpl b/public/templates/mpos/statistics/round/pplns_transactions.tpl index 4541d45f..6b46f1ae 100644 --- a/public/templates/mpos/statistics/round/pplns_transactions.tpl +++ b/public/templates/mpos/statistics/round/pplns_transactions.tpl @@ -16,7 +16,7 @@ {assign var=percentage1 value=0} {section txs $ROUNDTRANSACTIONS} - {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} + {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} {$PPLNSROUNDSHARES[txs].pplns_valid|number_format|default:"0"} diff --git a/public/templates/mpos/statistics/round/pplns_transactions_small.tpl b/public/templates/mpos/statistics/round/pplns_transactions_small.tpl index 998f0eab..b50c416d 100644 --- a/public/templates/mpos/statistics/round/pplns_transactions_small.tpl +++ b/public/templates/mpos/statistics/round/pplns_transactions_small.tpl @@ -19,7 +19,7 @@ {section txs $ROUNDTRANSACTIONS} - {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} + {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} {$SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid|number_format} {if $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid > 0 }{($SHARESDATA[$ROUNDTRANSACTIONS[txs].username].invalid / $SHARESDATA[$ROUNDTRANSACTIONS[txs].username].valid * 100)|number_format:"2"|default:"0"}{else}0.00{/if} diff --git a/public/templates/mpos/statistics/round/round_shares.tpl b/public/templates/mpos/statistics/round/round_shares.tpl index 9753c234..1cddbc6e 100644 --- a/public/templates/mpos/statistics/round/round_shares.tpl +++ b/public/templates/mpos/statistics/round/round_shares.tpl @@ -16,7 +16,7 @@ {section contrib $ROUNDSHARES} {$rank++} - {if $ROUNDSHARES[contrib].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDSHARES[contrib].username|escape}{/if} + {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} diff --git a/public/templates/mpos/statistics/round/round_transactions.tpl b/public/templates/mpos/statistics/round/round_transactions.tpl index 3a917ebd..f1cb8010 100644 --- a/public/templates/mpos/statistics/round/round_transactions.tpl +++ b/public/templates/mpos/statistics/round/round_transactions.tpl @@ -12,7 +12,7 @@ {section txs $ROUNDTRANSACTIONS} - {if $ROUNDTRANSACTIONS[txs].is_anonymous|default:"0" == 1}anonymous{else}{$ROUNDTRANSACTIONS[txs].username|escape}{/if} + {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"} {$ROUNDTRANSACTIONS[txs].amount|default:"0"|number_format:"8"}