diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index a7824b0e..78e4b59a 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -80,13 +80,13 @@ sub view_build : Chained('build') PathPart('') Args(0) { ]; } - #my $r = joinWithResultInfo( $c, $c->model('DB::Builds'))->search( - # { eval => { -in => $build->jobsetevalmembers->all->get_column('eval')->as_query } } - # , { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'], distinct => 1 } - # ); - #if ($r->count <= 100) { - # $c->stash->{relatedbuilds} = [$r->all]; - #} + my $maxRelated = 100; + my $r = $c->model('DB::Builds')->search( + { eval => { -in => $build->jobsetevalmembers->search({}, {rows => 1})->get_column('eval')->as_query } }, + { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'], distinct => 1, rows => $maxRelated + 1 } + ); + $c->stash->{relatedbuilds} = [$r->all]; + delete $c->stash->{relatedbuilds} if scalar(@{$c->stash->{relatedbuilds}}) > $maxRelated; }