From a25ea193f7dc6ce96ba3ae829e373addfe5c6123 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 13 Aug 2013 01:43:50 +0200 Subject: [PATCH] Add a /eval action to /build to go from a build to the latest finished eval --- src/lib/Hydra/Controller/Build.pm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/Hydra/Controller/Build.pm b/src/lib/Hydra/Controller/Build.pm index 446c2af1..cded877f 100644 --- a/src/lib/Hydra/Controller/Build.pm +++ b/src/lib/Hydra/Controller/Build.pm @@ -618,6 +618,22 @@ sub evals : Chained('buildChain') PathPart('evals') Args(0) { } +# Redirect to the latest finished evaluation that contains this build. +sub eval : Chained('buildChain') PathPart('eval') { + my ($self, $c, @rest) = @_; + + my $eval = $c->stash->{build}->jobsetevals->find( + { hasnewbuilds => 1 }, + { order_by => "id DESC", rows => 1 + , "not exists (select 1 from jobsetevalmembers m2 join builds b2 on me.eval = m2.eval and m2.build = b2.id and b2.finished = 0)" + }); + + notFound($c, "There is no finished evaluation containing this build.") unless defined $eval; + + $c->res->redirect($c->uri_for($c->controller('JobsetEval')->action_for("view"), [$eval->id], @rest, $c->req->params)); +} + + sub reproduce : Chained('buildChain') PathPart('reproduce') Args(0) { my ($self, $c) = @_; $c->response->content_type('text/x-shellscript');