* Cleanup.

This commit is contained in:
Eelco Dolstra 2010-03-05 16:37:24 +00:00
parent da25c963eb
commit 3501fa6465

View file

@ -166,34 +166,12 @@ sub findLastJobForBuilds {
($thisBuild) = $builds->search( ($thisBuild) = $builds->search(
{ project => $job->get_column('project'), jobset => $job->get_column('jobset') { project => $job->get_column('project'), jobset => $job->get_column('jobset')
, job => $job->get_column('job'), finished => 1 , job => $job->get_column('job'), finished => 1
} },
, { join => 'resultInfo', rows => 1 { join => 'resultInfo', rows => 1
, order_by => ["buildstatus", "timestamp"] , order_by => ["buildstatus", "timestamp"]
, where => \ attrsToSQL($job->attrs, "build.id") , where => \ attrsToSQL($job->attrs, "build.id")
, '+select' => ["resultInfo.buildstatus"], '+as' => ["buildstatus"] , '+select' => ["resultInfo.buildstatus"], '+as' => ["buildstatus"]
}); });
return $thisBuild ;
}
sub findLastJobForPrimaryBuild {
my ($primaryBuild, $job) = @_;
my $thisBuild;
my $depBuilds;
$depBuilds = $primaryBuild->dependentBuilds;
$thisBuild = findLastJobForBuilds($depBuilds, $job) ;
# don't do recursive yet
# if (!defined $thisBuild) {
#
# foreach my $build ($depBuilds->all) {
# $thisBuild = findLastJobForPrimaryBuild($build, $job) ;
# if (defined $thisBuild) {
# last ;
# }
# }
# }
return $thisBuild; return $thisBuild;
} }
@ -211,13 +189,9 @@ sub getViewResult {
my $timestamp = 0; my $timestamp = 0;
foreach my $job (@{$jobs}) { foreach my $job (@{$jobs}) {
my $thisBuild; my $thisBuild = $job->isprimary
? $primaryBuild
if ($job->isprimary) { : findLastJobForBuilds(scalar $primaryBuild->dependentBuilds, $job);
$thisBuild = $primaryBuild;
} else {
$thisBuild = findLastJobForPrimaryBuild($primaryBuild, $job) ;
}
if (!defined $thisBuild) { if (!defined $thisBuild) {
$status = 2 if $status == 0; # = unfinished $status = 2 if $status == 0; # = unfinished