Fix incorrect removed jobs in eval pages

PostgreSQL and Perl have different sort orders, in particular when
comparing job names such as "aspell.x86_64-linux" and
"aspellDicts.cs.i686-freebsd".  This confused the evaluation
comparison code, causing some jobs to appear as "removed".
So now we do all the sorting in Perl.

Fixes #105.
This commit is contained in:
Eelco Dolstra 2013-08-28 13:04:14 +00:00
parent d886ff9973
commit 42c4ef856f

View file

@ -51,10 +51,17 @@ sub view : Chained('eval') PathPart('') Args(0) {
$c->stash->{otherEval} = $eval2 if defined $eval2; $c->stash->{otherEval} = $eval2 if defined $eval2;
my @builds = $eval->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] }); sub cmpBuilds {
my @builds2 = defined $eval2 my ($a, $b) = @_;
? $eval2->builds->search({}, { order_by => ["job", "system", "id"], columns => [@buildListColumns] }) return $a->get_column('job') cmp $b->get_column('job')
: (); || $a->get_column('system') cmp $b->get_column('system')
}
my @builds = $eval->builds->search({}, { columns => [@buildListColumns] });
my @builds2 = defined $eval2 ? $eval2->builds->search({}, { columns => [@buildListColumns] }) : ();
@builds = sort { cmpBuilds($a, $b) } @builds;
@builds2 = sort { cmpBuilds($a, $b) } @builds2;
$c->stash->{stillSucceed} = []; $c->stash->{stillSucceed} = [];
$c->stash->{stillFail} = []; $c->stash->{stillFail} = [];
@ -70,8 +77,7 @@ sub view : Chained('eval') PathPart('') Args(0) {
my $found = 0; my $found = 0;
while ($n < scalar(@builds2)) { while ($n < scalar(@builds2)) {
my $build2 = $builds2[$n]; my $build2 = $builds2[$n];
my $d = $build->get_column('job') cmp $build2->get_column('job') my $d = cmpBuilds($build, $build2);
|| $build->get_column('system') cmp $build2->get_column('system');
last if $d == -1; last if $d == -1;
if ($d == 0) { if ($d == 0) {
$n++; $n++;