API: fixup filtering latestbuilds by project and jobset

This commit is contained in:
Graham Christensen 2022-01-14 13:34:00 -05:00
parent e5c8a35423
commit 86473f4b3c

View file

@ -54,12 +54,18 @@ sub latestbuilds : Chained('api') PathPart('latestbuilds') Args(0) {
my $system = $c->request->params->{system}; my $system = $c->request->params->{system};
my $filter = {finished => 1}; my $filter = {finished => 1};
$filter->{project} = $project if ! $project eq ""; $filter->{"jobset.project"} = $project if ! $project eq "";
$filter->{jobset} = $jobset if ! $jobset eq ""; $filter->{"jobset.name"} = $jobset if ! $jobset eq "";
$filter->{job} = $job if !$job eq ""; $filter->{job} = $job if !$job eq "";
$filter->{system} = $system if !$system eq ""; $filter->{system} = $system if !$system eq "";
my @latest = $c->model('DB::Builds')->search($filter, {rows => $nr, order_by => ["id DESC"] }); my @latest = $c->model('DB::Builds')->search(
$filter,
{
rows => $nr,
order_by => ["id DESC"],
join => [ "jobset" ]
});
my @list; my @list;
push @list, buildToHash($_) foreach @latest; push @list, buildToHash($_) foreach @latest;