Don't show duplicate builds in "Related builds"

Since a build may be a member of multiple jobset evaluations, we need
to do a "select distinct" here.  But maybe we should only show builds
from a single evaluation (e.g. the most recent), since showing builds
from several may be confusing.
This commit is contained in:
Eelco Dolstra 2012-02-21 17:16:32 +01:00
parent 2cf9b148eb
commit 578530dac2
2 changed files with 2 additions and 1 deletions

View file

@ -83,7 +83,7 @@ sub view_build : Chained('build') PathPart('') Args(0) {
my $r = joinWithResultInfo( $c, $c->model('DB::Builds'))->search( my $r = joinWithResultInfo( $c, $c->model('DB::Builds'))->search(
{ eval => { -in => $build->jobsetevalmembers->get_column('eval')->as_query } } { eval => { -in => $build->jobsetevalmembers->get_column('eval')->as_query } }
, { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'] } , { join => 'jobsetevalmembers', order_by => [ 'project', 'jobset', 'job'], distinct => 1 }
); );
if ($r->count <= 100) { if ($r->count <= 100) {
$c->stash->{relatedbuilds} = [$r->all]; $c->stash->{relatedbuilds} = [$r->all];

View file

@ -437,6 +437,7 @@
<div id="tabs-relatedbuilds"> <div id="tabs-relatedbuilds">
<h2>Related builds</h2> <h2>Related builds</h2>
<p>The following builds are part of the same jobset evaluation that produced this build.</p>
[% INCLUDE renderBuildList builds=relatedbuilds%] [% INCLUDE renderBuildList builds=relatedbuilds%]
</div> </div>
[% END %] [% END %]