forked from lix-project/hydra
Cleanup
This commit is contained in:
parent
fd50ac1d4e
commit
b9824ca422
|
@ -49,19 +49,7 @@ sub jobsetIndex {
|
|||
}
|
||||
}
|
||||
|
||||
$c->stash->{evals} = [ $c->stash->{jobset}->jobsetevals->search(
|
||||
{ hasnewbuilds => 1 },
|
||||
{ order_by => "id DESC"
|
||||
, '+select' => # !!! Slow - should precompute this.
|
||||
[ "(select count(*) from JobsetEvalMembers where eval = me.id)"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 0))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
|
||||
]
|
||||
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
||||
, rows => 6
|
||||
}
|
||||
) ];
|
||||
$c->stash->{evals} = getEvals($self, $c, 0, 6);
|
||||
|
||||
$c->stash->{systems} =
|
||||
[ $c->stash->{jobset}->builds->search({ iscurrent => 1 }, { select => ["system"], distinct => 1, order_by => "system" }) ];
|
||||
|
@ -337,6 +325,25 @@ sub clone_submit : Chained('jobset') PathPart('clone/submit') Args(0) {
|
|||
}
|
||||
|
||||
|
||||
sub getEvals {
|
||||
my ($self, $c, $offset, $rows) = @_;
|
||||
return [ $c->stash->{jobset}->jobsetevals->search(
|
||||
{ hasnewbuilds => 1 },
|
||||
{ order_by => "id DESC"
|
||||
, '+select' => # !!! Slow - should precompute this.
|
||||
[ "(select count(*) from JobsetEvalMembers where eval = me.id)"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 0))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
|
||||
]
|
||||
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
||||
, rows => $rows
|
||||
, offset => $offset
|
||||
}
|
||||
) ];
|
||||
}
|
||||
|
||||
|
||||
sub evals : Chained('jobset') PathPart('evals') Args(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
@ -350,20 +357,7 @@ sub evals : Chained('jobset') PathPart('evals') Args(0) {
|
|||
$c->stash->{resultsPerPage} = $resultsPerPage;
|
||||
$c->stash->{total} = $c->stash->{jobset}->jobsetevals->search({hasnewbuilds => 1})->count;
|
||||
|
||||
$c->stash->{evals} = [ $c->stash->{jobset}->jobsetevals->search(
|
||||
{ hasnewbuilds => 1 },
|
||||
{ order_by => "id DESC"
|
||||
, '+select' => # !!! Slow - should precompute this.
|
||||
[ "(select count(*) from JobsetEvalMembers where eval = me.id)"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 0))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1))"
|
||||
, "(select count(*) from JobsetEvalMembers where eval = me.id and exists(select 1 from Builds b where b.id = build and b.finished = 1 and b.buildStatus = 0))"
|
||||
]
|
||||
, '+as' => [ "nrBuilds", "nrScheduled", "nrFinished", "nrSucceeded" ]
|
||||
, rows => $resultsPerPage + 1
|
||||
, offset => ($page - 1) * $resultsPerPage
|
||||
}
|
||||
) ];
|
||||
$c->stash->{evals} = getEvals($self, $c, ($page - 1) * $resultsPerPage, $resultsPerPage + 1)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,9 +81,9 @@
|
|||
</ul>
|
||||
<div id="generic-tabs" class="tab-content">
|
||||
<div id="tabs-information" class="tab-pane active">
|
||||
[% IF !edit-%]
|
||||
[% IF !edit && evals.size() > 0 -%]
|
||||
<h2>Most recent evaluations</h2>
|
||||
[% INCLUDE renderEvals nrShown=5 linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %]
|
||||
[% INCLUDE renderEvals nrShown=evals.size() - 1 linkToAll=c.uri_for(c.controller('Jobset').action_for('evals'), [project.name, jobset.name]) %]
|
||||
[% END %]
|
||||
[% IF !edit && activeJobsStatus -%]
|
||||
<h2>Status</h2>
|
||||
|
|
Loading…
Reference in a new issue