From 469893cd4a95ac84c1d1e474fd2228e2e9dd1003 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 25 Apr 2009 11:41:46 +0000 Subject: [PATCH] * The "latest" channel shouldn't contain inactive jobs. --- src/lib/Hydra/Base/Controller/ListBuilds.pm | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/lib/Hydra/Base/Controller/ListBuilds.pm b/src/lib/Hydra/Base/Controller/ListBuilds.pm index 3426a1d6..ec5abdf5 100644 --- a/src/lib/Hydra/Base/Controller/ListBuilds.pm +++ b/src/lib/Hydra/Base/Controller/ListBuilds.pm @@ -7,17 +7,23 @@ use Hydra::Helper::Nix; use Hydra::Helper::CatalystUtils; -sub getJobStatus { - my ($self, $c) = @_; - - my $latest = joinWithResultInfo($c, $c->stash->{jobStatus}); - - $latest = $latest->search( +sub filterInactiveJobs { + my ($build) = @_; + return $build->search( { active => 1 }, { join => 'job' , '+select' => ["job.active"] , '+as' => ["active"] }) +} + + +sub getJobStatus { + my ($self, $c) = @_; + + my $latest = joinWithResultInfo($c, $c->stash->{jobStatus}); + + $latest = filterInactiveJobs($latest) unless defined $c->stash->{showInactiveJobs}; return $latest; @@ -77,7 +83,7 @@ sub nix : Chained('get_builds') PathPart('channel') CaptureArgs(1) { eval { if ($channelName eq "latest") { $c->stash->{channelName} = $c->stash->{channelBaseName} . "-latest"; - getChannelData($c, scalar($c->stash->{latestSucceeded})); + getChannelData($c, scalar(filterInactiveJobs($c->stash->{latestSucceeded}))); } elsif ($channelName eq "all") { $c->stash->{channelName} = $c->stash->{channelBaseName} . "-all";