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XFRQS4JKXFZQC
PMNWRTGJ4GVSMSSAWSUD57B26PCRAHMZIQ5SIWJIK7A74ENKEQLAC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
BDSD2JLV4V4I52SE7MCZLYNDC4XU27ZNH7TYKLT7CA7YR5WRMQBAC
4WZQW2N6NJSIKSK7DCOV2YVEG5C45LLUM2FCCZRLISUXUGMBGF6QC
IK53RV4VGOHLCZGQCCIKPB45M3C7M7YMNBOJFBGZJ4LWIZNU4QNQC
2VBQRQ2QUNM3ZC7I7WAXYSUVPP52IY2KLE4CVS3E4MAHL2T42KKQC
2JQ7WEFMU5IPCUKLGRLVVT4MYMKVHJDZVMOOOPL6K5RLEZ532LGQC
JARRBLZDQ2JZWY7IUVPTOT7WJMBPMLFLF2MGLVGOYROAAISYGLSAC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
D5QIOJGPKQJIYBUCSC3MFJ3TXLPNZ2XMI37GXMFRVRFWWR2VMTFAC
PZL3SZM3U3BYJX2RGYXC6NMBG7WQHFWHSYDYXZ7Q5VZA3EDYVPIQC
QL55ECJ6KMMBUOWQ6LKSOVN7L43CH4S6SPE2AQ3VX3KSGC32RP4AC
}
sub getEvals {
my ($self, $c, $offset, $rows) = @_;
my @evals = $c->stash->{jobset}->jobsetevals->search(
{ hasnewbuilds => 1 },
{ order_by => "id DESC", rows => $rows + 1, offset => $offset });
my @res = ();
my $prevInputs = [];
my $prev;
for (my $n = scalar @evals - 1; $n >= 0; $n--) {
my $cur = $evals[$n];
# Get stats for this eval.
my $nrScheduled;
my $nrSucceeded = $cur->nrsucceeded;
if (defined $nrSucceeded) {
$nrScheduled = 0;
} else {
$nrScheduled = $cur->builds->search({finished => 0})->count;
$nrSucceeded = $cur->builds->search({finished => 1, buildStatus => 0})->count;
if ($nrScheduled == 0) {
$cur->update({nrsucceeded => $nrSucceeded});
}
}
# Compute what inputs changed between each eval.
my $curInputs = [ $cur->jobsetevalinputs->search(
{ -or => [ -and => [ uri => { '!=' => undef }, revision => { '!=' => undef }], dependency => { '!=' => undef }], altNr => 0 },
{ order_by => "name" }) ];
my @changedInputs;
my %prevInputsHash;
$prevInputsHash{$_->name} = $_ foreach @{$prevInputs};
foreach my $input (@{$curInputs}) {
my $p = $prevInputsHash{$input->name};
push @changedInputs, $input
if !defined $p || ($input->revision || "") ne ($p->revision || "") || $input->type ne $p->type || ($input->uri || "") ne ($p->uri || "") ||
( defined $input->dependency && defined $p->dependency && $input->dependency->id ne $p->dependency->id);
}
$prevInputs = $curInputs;
my $e =
{ eval => $cur
, nrScheduled => $nrScheduled
, nrSucceeded => $nrSucceeded
, nrFailed => $cur->nrbuilds - $nrSucceeded - $nrScheduled
, diff => defined $prev ? $nrSucceeded - $prev->{nrSucceeded} : 0
, changedInputs => [ @changedInputs ]
};
push @res, $e if $n < $rows;
$prev = $e;
}
return [reverse @res];
$c->stash->{total} = $c->stash->{jobset}->jobsetevals->search({hasnewbuilds => 1})->count;
$c->stash->{evals} = getEvals($self, $c, ($page - 1) * $resultsPerPage, $resultsPerPage)
$c->stash->{total} = $evals->search({hasnewbuilds => 1})->count;
$c->stash->{evals} = getEvals($self, $c, $evals, ($page - 1) * $resultsPerPage, $resultsPerPage)
}
sub evals :Local Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'evals.tt';
my $page = int($c->req->param('page') || "1") || 1;
my $resultsPerPage = 20;
my $evals = $c->model('DB::JobsetEvals');
$c->stash->{page} = $page;
$c->stash->{resultsPerPage} = $resultsPerPage;
$c->stash->{total} = $evals->search({hasnewbuilds => 1})->count;
$c->stash->{evals} = getEvals($self, $c, $evals, ($page - 1) * $resultsPerPage, $resultsPerPage)
}
sub getEvals {
my ($self, $c, $evals, $offset, $rows) = @_;
my @evals = $evals->search(
{ hasnewbuilds => 1 },
{ order_by => "id DESC", rows => $rows + 1, offset => $offset });
my @res = ();
my $prevInputs = [];
my $prev;
for (my $n = scalar @evals - 1; $n >= 0; $n--) {
my $cur = $evals[$n];
# Get stats for this eval.
my $nrScheduled;
my $nrSucceeded = $cur->nrsucceeded;
if (defined $nrSucceeded) {
$nrScheduled = 0;
} else {
$nrScheduled = $cur->builds->search({finished => 0})->count;
$nrSucceeded = $cur->builds->search({finished => 1, buildStatus => 0})->count;
if ($nrScheduled == 0) {
$cur->update({nrsucceeded => $nrSucceeded});
}
}
# Compute what inputs changed between each eval.
my $curInputs = [ $cur->jobsetevalinputs->search(
{ -or => [ -and => [ uri => { '!=' => undef }, revision => { '!=' => undef }], dependency => { '!=' => undef }], altNr => 0 },
{ order_by => "name" }) ];
my @changedInputs;
my %prevInputsHash;
$prevInputsHash{$_->name} = $_ foreach @{$prevInputs};
foreach my $input (@{$curInputs}) {
my $p = $prevInputsHash{$input->name};
push @changedInputs, $input
if !defined $p || ($input->revision || "") ne ($p->revision || "") || $input->type ne $p->type || ($input->uri || "") ne ($p->uri || "") ||
( defined $input->dependency && defined $p->dependency && $input->dependency->id ne $p->dependency->id);
}
$prevInputs = $curInputs;
my $e =
{ eval => $cur
, nrScheduled => $nrScheduled
, nrSucceeded => $nrSucceeded
, nrFailed => $cur->nrbuilds - $nrSucceeded - $nrScheduled
, diff => defined $prev ? $nrSucceeded - $prev->{nrSucceeded} : 0
, changedInputs => [ @changedInputs ]
};
push @res, $e if $n < $rows;
$prev = $e;
}
return [reverse @res];