From 5cbbad7ac667931535ee9b50d3ec3a72df953a1a Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 21 Aug 2014 19:17:51 +1000 Subject: [PATCH] php - format stats numbers --- pool/page_stats.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/pool/page_stats.php b/pool/page_stats.php index 2e5c108f..0b0ba88e 100644 --- a/pool/page_stats.php +++ b/pool/page_stats.php @@ -2,7 +2,7 @@ # function allusersort($a, $b) { - $cmp = $a['u_hashrate5m'] != $b['u_hashrate5m']; + $cmp = $b['u_hashrate5m'] - $a['u_hashrate5m']; if ($cmp != 0) return $cmp; return $a['userid'] - $b['userid']; @@ -44,16 +44,20 @@ function dostats($data, $user) $pg .= ''.$all[$i]['username'].''; $uhr = $all[$i]['u_hashrate5m']; if ($uhr == '?') - $uhr = '?GHs'; + $dsp = '?GHs'; else { $uhr /= 10000000; if ($uhr < 100000) - $uhr = (round($uhr)/100).'GHs'; + $rate = 'G'; else - $uhr = (round($uhr/1000)/100).'THs'; + { + $rate = 'T'; + $uhr /= 1000; + } + $dsp = number_format($urh/100, 2); } - $pg .= "$uhr"; + $pg .= "$dsp"; $pg .= "\n"; } }