From d0bcaa62844d09559a79e3d97c0f6d49d33e0d30 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 28 Aug 2013 15:46:08 +0200 Subject: [PATCH] Allow comparing an eval against the jobset one day/week/month before --- src/lib/Hydra/Controller/JobsetEval.pm | 5 +++++ src/root/jobset-eval.tt | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Controller/JobsetEval.pm b/src/lib/Hydra/Controller/JobsetEval.pm index af1d7b15..592851b5 100644 --- a/src/lib/Hydra/Controller/JobsetEval.pm +++ b/src/lib/Hydra/Controller/JobsetEval.pm @@ -36,6 +36,11 @@ sub view : Chained('eval') PathPart('') Args(0) { if ($compare =~ /^\d+$/) { $eval2 = $c->model('DB::JobsetEvals')->find($compare) or notFound($c, "Evaluation $compare doesn't exist."); + } elsif ($compare =~ /^-(\d+)$/) { + my $t = int($1); + $eval2 = $c->stash->{jobset}->jobsetevals->find( + { hasnewbuilds => 1, timestamp => {'<=', $eval->timestamp - $t} }, + { order_by => "timestamp desc", rows => 1}); } elsif (defined $compare && $compare =~ /^($jobsetNameRE)$/) { my $j = $c->stash->{project}->jobsets->find({name => $compare}) or notFound($c, "Jobset $compare doesn't exist."); diff --git a/src/root/jobset-eval.tt b/src/root/jobset-eval.tt index f622c6fe..b328bd81 100644 --- a/src/root/jobset-eval.tt +++ b/src/root/jobset-eval.tt @@ -4,7 +4,11 @@
Compare to...