getPreviousBuild: Get previous build in the job, not jobset

Broken since 8adb433e3.
This commit is contained in:
Eelco Dolstra 2020-10-28 13:29:02 +01:00
parent a1b5418114
commit d9dc7ca18b

View file

@ -46,11 +46,13 @@ sub getBuild {
sub getPreviousBuild {
my ($build) = @_;
return undef if !defined $build;
# FIXME: slow
return $build->jobset->builds->search(
{ finished => 1
, system => $build->system
, 'me.id' => { '<' => $build->id }
, -not => { buildstatus => { -in => [4, 3]} }
, job => $build->job
, -not => { buildstatus => { -in => [4, 3]} }
}, { rows => 1, order_by => "me.id DESC" })->single;
}