perl: jobsetevals -> jobset via by jobset_id

Frankly, this was suspiciously little work.
This commit is contained in:
Graham Christensen 2021-01-26 09:50:59 -05:00
parent 54341cd9f6
commit 54b8cb188e
No known key found for this signature in database
GPG key ID: FE918C3A98C1030F
5 changed files with 8 additions and 5 deletions

View file

@ -34,7 +34,7 @@ sub machines : Chained('admin') PathPart('machines') Args(0) {
sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) { sub clear_queue_non_current : Chained('admin') PathPart('clear-queue-non-current') Args(0) {
my ($self, $c) = @_; my ($self, $c) = @_;
my $builds = $c->model('DB::Builds')->search( my $builds = $c->model('DB::Builds')->search(
{ id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by project, jobset)))" } { id => { -in => \ "select id from Builds where id in ((select id from Builds where finished = 0) except (select build from JobsetEvalMembers where eval in (select max(id) from JobsetEvals where hasNewBuilds = 1 group by jobset_id)))" }
}); });
my $n = cancelBuilds($c->model('DB')->schema, $builds); my $n = cancelBuilds($c->model('DB')->schema, $builds);
$c->flash->{successMsg} = "$n builds have been cancelled."; $c->flash->{successMsg} = "$n builds have been cancelled.";

View file

@ -16,8 +16,8 @@ sub evalChain : Chained('/') PathPart('eval') CaptureArgs(1) {
or notFound($c, "Evaluation $evalId doesn't exist."); or notFound($c, "Evaluation $evalId doesn't exist.");
$c->stash->{eval} = $eval; $c->stash->{eval} = $eval;
$c->stash->{project} = $eval->project;
$c->stash->{jobset} = $eval->jobset; $c->stash->{jobset} = $eval->jobset;
$c->stash->{project} = $eval->jobset->project;
} }

View file

@ -219,7 +219,7 @@ sub getEvals {
foreach my $curEval (@evals) { foreach my $curEval (@evals) {
my ($prevEval) = $c->model('DB::JobsetEvals')->search( my ($prevEval) = $c->model('DB::JobsetEvals')->search(
{ project => $curEval->get_column('project'), jobset => $curEval->get_column('jobset') { jobset_id => $curEval->get_column('jobset_id')
, hasnewbuilds => 1, id => { '<', $curEval->id } }, , hasnewbuilds => 1, id => { '<', $curEval->id } },
{ order_by => "id DESC", rows => 1 }); { order_by => "id DESC", rows => 1 });

View file

@ -463,7 +463,7 @@ BLOCK renderEvals %]
<tr> <tr>
<td><a class="row-link" href="[% link %]">[% eval.id %]</a></td> <td><a class="row-link" href="[% link %]">[% eval.id %]</a></td>
[% IF !jobset && !build %] [% IF !jobset && !build %]
<td>[% INCLUDE renderFullJobsetName project=eval.get_column('project') jobset=eval.get_column('jobset') %]</td> <td>[% INCLUDE renderFullJobsetName project=eval.jobset.project.name jobset=eval.jobset.name %]</td>
[% END %] [% END %]
<td class="nowrap">[% INCLUDE renderRelativeDate timestamp = eval.timestamp %]</td> <td class="nowrap">[% INCLUDE renderRelativeDate timestamp = eval.timestamp %]</td>
<td> <td>

View file

@ -191,8 +191,11 @@ sub fetchInputEval {
$eval = getLatestFinishedEval($jobset); $eval = getLatestFinishedEval($jobset);
die "jobset $value does not have a finished evaluation\n" unless defined $eval; die "jobset $value does not have a finished evaluation\n" unless defined $eval;
} elsif ($value =~ /^($projectNameRE):($jobsetNameRE):($jobNameRE)$/) { } elsif ($value =~ /^($projectNameRE):($jobsetNameRE):($jobNameRE)$/) {
my $jobset = $db->resultset('Jobsets')->find({ project => $1, name => $2 });
die "jobset $1:$2 does not exist\n" unless defined $jobset;
$eval = $db->resultset('JobsetEvals')->find( $eval = $db->resultset('JobsetEvals')->find(
{ project => $1, jobset => $2, hasnewbuilds => 1 }, { jobset_id => $jobset->id, hasnewbuilds => 1 },
{ order_by => "id DESC", rows => 1 { order_by => "id DESC", rows => 1
, where => , where =>
\ [ # All builds in this jobset should be finished... \ [ # All builds in this jobset should be finished...