From 6e7e1fa6de4c49cc95b80694e5a49a29add7c4fb Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 30 Aug 2014 00:10:06 +1000 Subject: [PATCH] php - add a total at the bottom of workers --- pool/page_workers.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pool/page_workers.php b/pool/page_workers.php index 8e305dfa..0456d168 100644 --- a/pool/page_workers.php +++ b/pool/page_workers.php @@ -19,6 +19,7 @@ function doworker($data, $user) $pg .= "\n"; if ($ans['STATUS'] == 'ok') { + $tot = 0; $count = $ans['rows']; for ($i = 0; $i < $count; $i++) { @@ -89,6 +90,7 @@ function doworker($data, $user) $uhr = '?GHs'; else { + $tot += $uhr; $uhr /= 10000000; if ($uhr < 0.01) $uhr = '0GHs'; @@ -104,6 +106,21 @@ function doworker($data, $user) $pg .= "\n"; } } + $thr /= 10000000; + if ($thr < 0.01) + $thr = '0GHs'; + else + { + if ($thr < 100000) + $thr = number_format(round($thr)/100,2).'GHs'; + else + $thr = number_format(round($thr/1000)/100,2).'THs'; + } + if (($i % 2) == 0) + $row = 'even'; + else + $row = 'odd'; + $pg .= "$thr\n"; $pg .= "\n"; return $pg;