project with 0 build resulted in error

This commit is contained in:
Rob Vermaas 2009-11-18 12:59:58 +00:00
parent 8911351e7b
commit f55e0444c9

View file

@ -37,9 +37,13 @@ sub getBuildStats {
{finished => 0, busy => 1}, {finished => 0, busy => 1},
{join => 'schedulingInfo'}) || 0; {join => 'schedulingInfo'}) || 0;
$c->stash->{totalBuildTime} = $builds->search({}, my $res;
$res = $builds->search({},
{join => 'resultInfo', select => {sum => 'stoptime - starttime'}, as => ['sum']}) {join => 'resultInfo', select => {sum => 'stoptime - starttime'}, as => ['sum']})
->first->get_column('sum') || 0; ->first ;
$c->stash->{totalBuildTime} = defined ($res) ? $res->get_column('sum') : 0 ;
} }