Split this into (1) get the data from the db (2) process it into the
form we want.

This will make it easy to cache (1).

Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com>
---
 sg-report-job-history | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/sg-report-job-history b/sg-report-job-history
index 39ebe024..d5e37bcd 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -260,14 +260,17 @@ END
        my $hosts = join ", ", map { $r->{Hosts}{$_} // "-" } @hostvarcols;
        my $hosts_colour = report_altchangecolour(\$alt_hosts, $hosts);
        print H "<td $hosts_colour>".encode_entities($hosts)."</td>\n";
+       my %osstestrevs;
        $osstestverq->execute($r->{Flight}{flight});
+       while (my ($harness) = $osstestverq->fetchrow_array()) {
+           $osstestrevs{$harness}++;
+       }
        my $osstestrevs = join ' ',
             map {
-               $_ = $_->{harness};
                s/^([0-9a-f]{12})[0-9a-f]+\b/$1/;
                "<kbd>".encode_entities($_)."</kbd>";
             }
-            @{ $osstestverq->fetchall_arrayref({}) };
+            sort keys %osstestrevs;
        my $osstest_colour = report_altchangecolour(\$alt_osstest, 
$osstestrevs);
        print H "<td $osstest_colour>$osstestrevs</td>\n";
        foreach my $i (0..$#rev_grid_cols) {
-- 
2.11.0


Reply via email to