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