]> xenbits.xensource.com Git - osstest.git/commitdiff
sg-report-job-history (nfc): Make $ri->{Hosts} a hash
authorIan Jackson <ian.jackson@eu.citrix.com>
Mon, 10 Aug 2020 15:02:00 +0000 (16:02 +0100)
committerIan Jackson <ian.jackson@eu.citrix.com>
Wed, 19 Aug 2020 10:41:18 +0000 (11:41 +0100)
This will make it easier to cache this.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
sg-report-job-history

index 8932458e2921cc4e734931cd7617a4253ec565b3..118926c64d2e78bc79020f81b8dd39ed202a20e7 100755 (executable)
@@ -173,11 +173,11 @@ END
     while (my $f= $flightsq->fetchrow_hashref()) {
         my $ri= report_run_getinfo($f);
 
-       $ri->{Hosts} = [ ];
+       $ri->{Hosts} = { };
        foreach my $hostvar (@hostvarcols) {
            $hostq->execute($f->{flight}, $f->{job}, $hostvar);
            my ($host) = $hostq->fetchrow_array();
-           push @{ $ri->{Hosts} }, ($host // "-");
+           $ri->{Hosts}{$hostvar} = $host;
        }
 
         my %revisions;
@@ -255,7 +255,7 @@ END
        print H "<td $r->{ColourAttr}><a href=\"$url\">".
            $r->{Content}."</a></td>\n";
        my $lastrev;
-       my $hosts = join ", ", map { $_ // "-" } @{ $r->{Hosts} };
+       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";
        $osstestverq->execute($r->{Flight}{flight});