From 405da3cb34c7f27453371f0479afbc684e156f82 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 20 Jul 2015 11:19:53 +1000 Subject: [PATCH] php - set header invalids to show for both shares and diff --- pool/page.php | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/pool/page.php b/pool/page.php index 6a64d2eb..58edbc07 100644 --- a/pool/page.php +++ b/pool/page.php @@ -165,6 +165,7 @@ function pgtop($info, $dotop, $user, $douser) $nlb = '?'; $pac = '0'; $per = '0'; + $perset = false; $uhr = '?GHs'; $u1hr = ''; if ($info !== false) @@ -244,12 +245,46 @@ function pgtop($info, $dotop, $user, $douser) } } + if (isset($info['blockshareinv'])) + { + $shinv = $info['blockshareinv']; + $per = siprefmt($shinv, 1); + $perset = true; + if (isset($info['blockshareacc'])) + { + $shacc = $info['blockshareacc']; + if (($shacc+$shinv) > 0) + { + $amt = 100.0 * $shinv / ($shacc + $shinv); + if (round($amt, 2) > 9.99) + $per .= ' ('.number_format($amt, 1).'%)'; + else + $per .= ' ('.number_format($amt, 2).'%)'; + } + } + } + if (isset($info['blockerr'])) { - $rej = $info['blockerr']; - $per = number_format($info['blockerr'], 0); - if (isset($info['blockacc']) && ($acc+$rej) > 0) - $per .= ' ('.number_format(100.0*$rej/($acc+$rej), 3).'%)'; + if ($perset == false) + $per = ''; + else + $per .= ' · '; + + $inv = $info['blockerr']; + $per .= siprefmt($inv, 1); + if (isset($info['blockacc'])) + { + $acc = $info['blockacc']; + if (($acc+$inv) > 0) + { + $amt = 100.0 * $inv / ($acc + $inv); + if (round($amt, 2) > 9.99) + $per .= ' ('.number_format($amt, 1).'%)'; + else + $per .= ' ('.number_format($amt, 2).'%)'; + } + } } if (isset($info['u_hashrate5m'])) @@ -350,7 +385,7 @@ function pgtop($info, $dotop, $user, $douser) $top .= " $phr"; $top .= 'Shares: '; $top .= " $pac"; - $top .= 'Invalid: '; + $top .= 'Invalids: '; $top .= " $per"; $top .= ''; $top .= '';