getEvals: order by the eval table's ID

I broke this when I added `me.` in f1e75c8bff

I added me. to disambiguate `id`, but:

* eval.id works on the per-build page
* me.id works on the other pages
* Just id works everywhere if I drop:

    , prefetch => { evaluationerror => [ ] },

  but this causes a query per row to collect the evaluationerror
  records later, this becomes significantly slow on non-trivial
  datasets.

Using evals->current_source_alias will use the correct alias
whether it is me or eval or something else.
This commit is contained in:
Graham Christensen 2021-06-16 11:22:25 -04:00
parent 2ac47e8013
commit bf5c76feb6

View file

@ -226,10 +226,12 @@ sub getEvalInfo {
sub getEvals { sub getEvals {
my ($self, $c, $evals, $offset, $rows) = @_; my ($self, $c, $evals, $offset, $rows) = @_;
my $me = $evals->current_source_alias;
my @evals = $evals->search( my @evals = $evals->search(
{ hasnewbuilds => 1 }, { hasnewbuilds => 1 },
{ order_by => "me.id DESC", rows => $rows, offset => $offset { order_by => "$me.id DESC", rows => $rows, offset => $offset
, prefetch => { evaluationerror => [ ] } }); , prefetch => { evaluationerror => [ ] } });
my @res = (); my @res = ();
my $cache = {}; my $cache = {};