diff --git a/src/lib/Hydra/Controller/Jobset.pm b/src/lib/Hydra/Controller/Jobset.pm index a0a0cdf5..1bd773a6 100644 --- a/src/lib/Hydra/Controller/Jobset.pm +++ b/src/lib/Hydra/Controller/Jobset.pm @@ -351,9 +351,9 @@ sub evals : Chained('jobset') PathPart('evals') Args(0) { , "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))" , "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))" ] - , '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ] - , rows => $resultsPerPage - , page => $page + , '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ] + , rows => $resultsPerPage + 1 + , offset => ($page - 1) * $resultsPerPage } ) ]; } diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index 16fba67f..11bf9fa3 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -26,12 +26,35 @@ sub view : Chained('eval') PathPart('') Args(0) { my $eval = $c->stash->{eval}; - my ($eval2) = $eval->jobset->jobsetevals->search( - { hasnewbuilds => 1, id => { '<', $eval->id } }, - { order_by => "id DESC", rows => 1 }); + my $compare = $c->req->params->{compare}; + my $eval2; + # Allow comparing this evaluation against the previous evaluation + # (default), an arbitrary evaluation, or the latest completed + # evaluation of another jobset. + if (defined $compare && $compare =~ /^\d+$/) { + $eval2 = $c->model('DB::JobsetEvals')->find($compare) + or notFound($c, "Evaluation $compare doesn't exist."); + } elsif (defined $compare && $compare =~ /^($jobNameRE)$/) { + my $j = $c->stash->{project}->jobsets->find({name => $compare}) + or notFound($c, "Jobset $compare doesn't exist."); + ($eval2) = $j->jobsetevals->search( + { hasnewbuilds => 1 }, + { order_by => "id DESC", rows => 1 + , where => \ "not exists (select 1 from JobsetEvalMembers m join Builds b on m.build = b.id where m.eval = me.id and b.finished = 0)" + }); + } else { + ($eval2) = $eval->jobset->jobsetevals->search( + { hasnewbuilds => 1, id => { '<', $eval->id } }, + { order_by => "id DESC", rows => 1 }); + } + + $c->stash->{otherEval} = $eval2 if defined $eval2; + my @builds = $eval->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] }); - my @builds2 = $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] }); + my @builds2 = defined $eval2 + ? $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] }) + : (); $c->stash->{stillSucceed} = []; $c->stash->{stillFail} = []; @@ -44,12 +67,15 @@ sub view : Chained('eval') PathPart('') Args(0) { my $n = 0; foreach my $build (@builds) { my $d; + my $found = 0; while ($n < scalar(@builds2)) { my $build2 = $builds2[$n]; my $d = $build->get_column('job') cmp $build2->get_column('job') || $build->get_column('system') cmp $build2->get_column('system'); + last if $d == -1; if ($d == 0) { $n++; + $found = 1; if ($build->finished == 0 || $build2->finished == 0) { push @{$c->stash->{unfinished}}, $build; } elsif ($build->buildstatus == 0 && $build2->buildstatus == 0) { @@ -62,13 +88,11 @@ sub view : Chained('eval') PathPart('') Args(0) { push @{$c->stash->{nowFail}}, $build; } else { die; } last; - } elsif ($d == -1) { - push @{$c->stash->{new}}, $build; - last; } push @{$c->stash->{removed}}, { job => $build2->get_column('job'), system => $build2->get_column('system') }; $n++; } + push @{$c->stash->{new}}, $build if !$found; } $c->stash->{full} = ($c->req->params->{full} || "0") eq "1"; diff --git a/src/root/common.tt b/src/root/common.tt index ae7ae96e..1ac51db4 100644 --- a/src/root/common.tt +++ b/src/root/common.tt @@ -38,10 +38,8 @@ [%- BLOCK renderFullJobsetName -%] - - [% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %] - -[% END %] +[% INCLUDE renderProjectName %]:[% INCLUDE renderJobsetName %] +[%- END -%] [%- BLOCK renderFullJobName -%] diff --git a/src/root/jobset-eval.tt b/src/root/jobset-eval.tt index e5c03737..ae2bf376 100644 --- a/src/root/jobset-eval.tt +++ b/src/root/jobset-eval.tt @@ -3,7 +3,13 @@

Jobset [% project.name %]:[% jobset.name %] evaluation [% eval.id %]

- +[%- IF otherEval -%] +

Comparisons are relative to [% INCLUDE renderFullJobsetName +project=otherEval.jobset.project.name jobset=otherEval.jobset.name %] +evaluation [% otherEval.id %].

+[%- END -%] [%- BLOCK renderSome -%] [% size = builds.size; max = full ? size : 30; %] diff --git a/src/root/jobset-evals.tt b/src/root/jobset-evals.tt index 1b38f6ba..1ba812c9 100644 --- a/src/root/jobset-evals.tt +++ b/src/root/jobset-evals.tt @@ -4,9 +4,11 @@

Evaluations of Jobset [% INCLUDE renderLink uri = c.uri_for(c.controller('Project').action_for('view'), [project.name]) title = project.name %]:[% jobset.name %]

+ +[% nrShown = evals.size > resultsPerPage ? resultsPerPage : evals.size %]

Showing evaluations [% (page - 1) * resultsPerPage + 1 %] - [% -(page - 1) * resultsPerPage + evals.size %] out of [% total %].

+(page - 1) * resultsPerPage + nrShown %] out of [% total %].

[% INCLUDE renderPager %] @@ -19,7 +21,7 @@ - [% last = evals.size - 2; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %] + [% last = nrShown - 1; FOREACH n IN [0..last]; eval = evals.$n; m = n + 1; next = evals.$m; %] [% eval.id %]  [% INCLUDE renderDateTime timestamp = eval.timestamp %]