* In the last succeeded / job status queries, use the Builds.isCurrent
column instead of Jobs.active.
This commit is contained in:
@ -7,25 +7,11 @@ use Hydra::Helper::Nix;
|
||||
use Hydra::Helper::CatalystUtils;
|
||||
|
||||
|
||||
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};
|
||||
|
||||
$latest = $latest->search(
|
||||
{},
|
||||
{ '+select' => ["me.statusChangeId", "me.statusChangeTime"]
|
||||
@ -90,7 +76,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(filterInactiveJobs($c->stash->{latestSucceeded})));
|
||||
getChannelData($c, scalar($c->stash->{latestSucceeded}));
|
||||
}
|
||||
elsif ($channelName eq "all") {
|
||||
$c->stash->{channelName} = $c->stash->{channelBaseName} . "-all";
|
||||
|
@ -15,7 +15,6 @@ sub job : Chained('/') PathPart('job') CaptureArgs(3) {
|
||||
or notFound($c, "Job $projectName:$jobsetName:$jobName doesn't exist.");
|
||||
$c->stash->{project} = $c->stash->{job}->project;
|
||||
$c->stash->{jobset} = $c->stash->{job}->jobset;
|
||||
$c->stash->{showInactiveJobs} = 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,7 +28,7 @@ sub index : Chained('jobset') PathPart('') Args(0) {
|
||||
|
||||
getBuildStats($c, scalar $c->stash->{jobset}->builds);
|
||||
|
||||
$c->stash->{activeJobs} = [$c->stash->{jobset}->jobs->search({active => 1})];
|
||||
$c->stash->{activeJobs} = [$c->stash->{jobset}->builds->search({isCurrent => 1}, {select => ["job"], distinct => 1})];
|
||||
$c->stash->{inactiveJobs} = [$c->stash->{jobset}->jobs->search({active => 0})];
|
||||
}
|
||||
|
||||
|
@ -227,6 +227,8 @@ sub makeQueries {
|
||||
(r.buildstatus != 0 and r2.buildstatus = 0)))
|
||||
QUERY
|
||||
|
||||
my $activeJobs = "(select distinct project, jobset, job, system from Builds where isCurrent = 1 $constraint)";
|
||||
|
||||
makeSource(
|
||||
"JobStatus$name",
|
||||
# Urgh, can't use "*" in the "select" here because of the status change join.
|
||||
@ -238,7 +240,10 @@ QUERY
|
||||
b.id as statusChangeId, b.timestamp as statusChangeTime
|
||||
from
|
||||
(select project, jobset, job, system, max(id) as id
|
||||
from Builds where finished = 1 $constraint group by project, jobset, job, system)
|
||||
from $activeJobs as activeJobs
|
||||
natural join Builds
|
||||
where finished = 1
|
||||
group by project, jobset, job, system)
|
||||
as latest
|
||||
natural join Builds x
|
||||
$joinWithStatusChange
|
||||
@ -251,8 +256,10 @@ QUERY
|
||||
select *
|
||||
from
|
||||
(select project, jobset, job, system, max(id) as id
|
||||
from Builds natural join BuildResultInfo
|
||||
where finished = 1 and buildStatus = 0 $constraint
|
||||
from $activeJobs as activeJobs
|
||||
natural join Builds
|
||||
natural join BuildResultInfo
|
||||
where finished = 1 and buildStatus = 0
|
||||
group by project, jobset, job, system
|
||||
) as latest
|
||||
natural join Builds
|
||||
|
Reference in New Issue
Block a user