From bf5c76feb6103444c2dd2ceb20b60129a1542f12 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Wed, 16 Jun 2021 11:22:25 -0400 Subject: [PATCH] getEvals: order by the eval table's ID I broke this when I added `me.` in f1e75c8bffec3f5f86122ee73e3c0f19e26ddb27 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. --- src/lib/Hydra/Helper/Nix.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index e198a56c..01f65ad2 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -226,10 +226,12 @@ sub getEvalInfo { sub getEvals { my ($self, $c, $evals, $offset, $rows) = @_; + my $me = $evals->current_source_alias; + my @evals = $evals->search( { hasnewbuilds => 1 }, - { order_by => "me.id DESC", rows => $rows, offset => $offset - , prefetch => { evaluationerror => [ ] } }); + { order_by => "$me.id DESC", rows => $rows, offset => $offset + , prefetch => { evaluationerror => [ ] } }); my @res = (); my $cache = {};