From f74e15cbc0a32fb6c5c66bccd7ab5e4d88aa027e Mon Sep 17 00:00:00 2001 From: kanoi Date: Fri, 14 Nov 2014 00:52:13 +1100 Subject: [PATCH] php - add CDF to block pages --- pool/page_blocks.php | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 09dc866d..95aeba1e 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -59,10 +59,12 @@ function doblocks($data, $user) $pg .= "Status"; $pg .= "Diff"; $pg .= "%"; + $pg .= "CDF"; $pg .= "\n"; $blktot = 0; $nettot = 0; $i = 0; + $orph = false; if ($ans['STATUS'] == 'ok') { $count = $ans['rows']; @@ -79,7 +81,10 @@ function doblocks($data, $user) $ex = ''; $stat = $ans['status:'.$i]; if ($stat == 'Orphan') + { $ex = 's'; + $orph = true; + } if ($stat == '1-Confirm') { if (isset($data['info']['lastheight'])) @@ -114,11 +119,15 @@ function doblocks($data, $user) $blktot += $diffacc; if ($stat != 'Orphan') $nettot += $netdiff; + + $cdfv = 1 - exp(-1 * $diffacc / $netdiff); + $cdf = number_format($cdfv, 2); } else { $bg = ''; $bpct = '?'; + $cdf = '?'; } $pg .= ""; @@ -130,6 +139,7 @@ function doblocks($data, $user) $pg .= "".$stat.''; $pg .= "$stara$acc"; $pg .= "$bpct"; + $pg .= "$cdf"; $pg .= "\n"; } } @@ -146,12 +156,26 @@ function doblocks($data, $user) $bg = " bgcolor=$bg"; $pg .= ""; + $pg .= 'Total:'; + $pg .= ''; - $pg .= "\n"; + $pg .= "\n"; + if ($orph === true) + { + $pg .= '