Browse Source

php - add CDF to block pages

master
kanoi 10 years ago
parent
commit
f74e15cbc0
  1. 30
      pool/page_blocks.php

30
pool/page_blocks.php

@ -59,10 +59,12 @@ function doblocks($data, $user)
$pg .= "<td class=dr>Status</td>"; $pg .= "<td class=dr>Status</td>";
$pg .= "<td class=dr>Diff</td>"; $pg .= "<td class=dr>Diff</td>";
$pg .= "<td class=dr>%</td>"; $pg .= "<td class=dr>%</td>";
$pg .= "<td class=dr>CDF</td>";
$pg .= "</tr>\n"; $pg .= "</tr>\n";
$blktot = 0; $blktot = 0;
$nettot = 0; $nettot = 0;
$i = 0; $i = 0;
$orph = false;
if ($ans['STATUS'] == 'ok') if ($ans['STATUS'] == 'ok')
{ {
$count = $ans['rows']; $count = $ans['rows'];
@ -79,7 +81,10 @@ function doblocks($data, $user)
$ex = ''; $ex = '';
$stat = $ans['status:'.$i]; $stat = $ans['status:'.$i];
if ($stat == 'Orphan') if ($stat == 'Orphan')
{
$ex = 's'; $ex = 's';
$orph = true;
}
if ($stat == '1-Confirm') if ($stat == '1-Confirm')
{ {
if (isset($data['info']['lastheight'])) if (isset($data['info']['lastheight']))
@ -114,11 +119,15 @@ function doblocks($data, $user)
$blktot += $diffacc; $blktot += $diffacc;
if ($stat != 'Orphan') if ($stat != 'Orphan')
$nettot += $netdiff; $nettot += $netdiff;
$cdfv = 1 - exp(-1 * $diffacc / $netdiff);
$cdf = number_format($cdfv, 2);
} }
else else
{ {
$bg = ''; $bg = '';
$bpct = '?'; $bpct = '?';
$cdf = '?';
} }
$pg .= "<tr class=$row>"; $pg .= "<tr class=$row>";
@ -130,6 +139,7 @@ function doblocks($data, $user)
$pg .= "<td class=dr$ex>".$stat.'</td>'; $pg .= "<td class=dr$ex>".$stat.'</td>';
$pg .= "<td class=dr>$stara$acc</td>"; $pg .= "<td class=dr>$stara$acc</td>";
$pg .= "<td class=dr$bg>$bpct</td>"; $pg .= "<td class=dr$bg>$bpct</td>";
$pg .= "<td class=dr>$cdf</td>";
$pg .= "</tr>\n"; $pg .= "</tr>\n";
} }
} }
@ -146,12 +156,26 @@ function doblocks($data, $user)
$bg = " bgcolor=$bg"; $bg = " bgcolor=$bg";
$pg .= "<tr class=$row>"; $pg .= "<tr class=$row>";
$pg .= '<td class=dr>Total:</td>';
$pg .= '<td class=dl colspan=';
if ($user === null) if ($user === null)
$pg .= "<td class=dl colspan=5></td>"; $pg .= '4';
else else
$pg .= "<td class=dl colspan=6></td>"; $pg .= '5';
$pg .= '></td>';
$pg .= "<td class=dr$bg>".$bpct.'</td>'; $pg .= "<td class=dr$bg>".$bpct.'</td>';
$pg .= "</tr>\n"; $pg .= "<td></td></tr>\n";
if ($orph === true)
{
$pg .= '<tr><td colspan=';
if ($user === null)
$pg .= '7';
else
$pg .= '8';
$pg .= ' class=dc><font size=-1><span class=st1>*</span>';
$pg .= '% total is adjusted to include orphans correctly';
$pg .= '</font></td></tr>';
}
} }
$pg .= "</table>\n"; $pg .= "</table>\n";

Loading…
Cancel
Save