From 706b60ecc7e575b4eea4e9ef7f24cf76119758e1 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sun, 7 Feb 2016 23:49:26 +1100 Subject: [PATCH 1/2] php - don't colour orphans or rejects on the blocks page --- pool/page_blocks.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index f74a2ece..0b9bd101 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -277,9 +277,17 @@ function doblocks($data, $user) if ($diffratio > 0) { $pct = 100.0 * $diffratio; - list($fg, $bg) = pctcolour($pct); - $bpct = "$approx".number_format($pct, 3).'%'; - $bg = " bgcolor=$bg"; + if ($conf != 'O' and $conf != 'R') + { + list($fg, $bg) = pctcolour($pct); + $bpct = "$approx".number_format($pct, 3).'%'; + $bg = " bgcolor=$bg"; + } + else + { + $bpct = "$approx".number_format($pct, 3).'%'; + $bg = ''; + } $blktot += $diffacc; if ($conf != 'O' and $conf != 'R') $nettot += $netdiff; From ef38eb30b39bc7571806d4bffeca42ca948c5402 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 8 Feb 2016 00:14:49 +1100 Subject: [PATCH 2/2] php - colour blocks based on total diff, including previous orphan/reject amounts --- pool/page_blocks.php | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/pool/page_blocks.php b/pool/page_blocks.php index 0b9bd101..2d2dbfad 100644 --- a/pool/page_blocks.php +++ b/pool/page_blocks.php @@ -194,6 +194,19 @@ function doblocks($data, $user) { $pg .= ''; $count = $ans['rows']; + $colpct = 0; + for ($i = $count - 1; $i >= 0; $i--) + { + $conf = $ans['confirmed:'.$i]; + $diffratio = $ans['diffratio:'.$i]; + if ($diffratio > 0) + { + $colpct += 100.0 * $diffratio; + $ans['colpct:'.$i] = $colpct; + if ($conf != 'O' and $conf != 'R') + $colpct = 0; + } + } for ($i = 0; $i < $count; $i++) { if (($i % 2) == 0) @@ -277,9 +290,10 @@ function doblocks($data, $user) if ($diffratio > 0) { $pct = 100.0 * $diffratio; + $colpct = $ans['colpct:'.$i]; if ($conf != 'O' and $conf != 'R') { - list($fg, $bg) = pctcolour($pct); + list($fg, $bg) = pctcolour($colpct); $bpct = "$approx".number_format($pct, 3).'%'; $bg = " bgcolor=$bg"; }