From 36289712d53e9a600ded996510fdd8f0a0f971d3 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 4 Sep 2012 16:07:11 +0000 Subject: sort grouped build durations --- lib.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib.php') diff --git a/lib.php b/lib.php index 6e29e9e..20d1a76 100644 --- a/lib.php +++ b/lib.php @@ -301,21 +301,26 @@ S; $newdata = array(); foreach ($data as $duration => $count) { if (false !== strpos($duration, 'hour')) { - $newdata['> 1 hour'] += $count; + $newdata['60 minutes'] += $count; } else { $d = explode(' ', $duration); - if ($d[0] > 15) { - $newdata['> 15 minutes'] += $count; + if ($d[0] > 20) { + $newdata['21 minutes'] += $count; } else { $newdata[$duration] = $count; } } } + uksort($newdata, "timesort"); $rows = array("['Duration', 'Builds']"); foreach ($newdata as $duration => $count) { if ($duration == '0 second') $duration = '< 1 minute'; + elseif ($duration == '21 minutes') + $duration = '> 20 minutes'; + elseif ($duration == '60 minutes') + $duration = '> 1 hour'; $rows[] = sprintf("['%s', %d]", $duration, $count); } -- cgit v1.2.1