From f55e0444c93807dbda28c38e7b6bb99aaf94d087 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Wed, 18 Nov 2009 12:59:58 +0000 Subject: [PATCH] project with 0 build resulted in error --- src/lib/Hydra/Helper/CatalystUtils.pm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index ae003a15..5217c4a4 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -36,10 +36,14 @@ sub getBuildStats { $c->stash->{busyBuilds} = $builds->search( {finished => 0, busy => 1}, {join => 'schedulingInfo'}) || 0; - - $c->stash->{totalBuildTime} = $builds->search({}, + + my $res; + $res = $builds->search({}, {join => 'resultInfo', select => {sum => 'stoptime - starttime'}, as => ['sum']}) - ->first->get_column('sum') || 0; + ->first ; + + $c->stash->{totalBuildTime} = defined ($res) ? $res->get_column('sum') : 0 ; + }