From 23055ad4e1fa2aa5106dad518a41388cff03c1b9 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Tue, 19 Apr 2011 12:09:23 +0000 Subject: count only once time for a given package --- index.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'index.php') diff --git a/index.php b/index.php index d70c514..2d88a3f 100644 --- a/index.php +++ b/index.php @@ -132,8 +132,7 @@ $r = preg_match_all($re, $pkgs = array(); -$buildtime_total = 0; -$build_count = 0; +$buildtime_total = array(); foreach ($matches as $val) { @@ -180,14 +179,16 @@ foreach ($matches as $val) { // 12 hours is be an acceptable threshold given current BS global perfs // as of April 2011 if ($pkgs[$key]['buildtime']['diff'] < 43200) { - $buildtime_total += $pkgs[$key]['buildtime']['diff']; - $build_count += 1; + $buildtime_total[$key] = $pkgs[$key]['buildtime']['diff']; } } } // sort by key in reverse order to have more recent pkgs first krsort($pkgs); +$build_count = count($buildtime_total); +$buildtime_total = array_sum($buildtime_total); + // count all packages statuses $stats = array( 'uploaded' => 0, -- cgit v1.2.1