From 20e3948705427c3c25f14f5f22af1c5313f1a044 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 5 Jan 2023 15:59:45 +0000 Subject: [PATCH] annotate status-bar code --- cgi-bin/show_status.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cgi-bin/show_status.pl b/cgi-bin/show_status.pl index d52394f..26967c0 100755 --- a/cgi-bin/show_status.pl +++ b/cgi-bin/show_status.pl @@ -65,13 +65,17 @@ EOS my $statrows=[]; my $sth=$db->prepare($statement); $sth->execute; + +# walk the set of result rows from the SQL query above while (my $row = $sth->fetchrow_hashref) { next if (@members && ! grep {$_ eq $row->{sysname} } @members); + $row->{build_flags} =~ s/^\{(.*)\}$/$1/; $row->{build_flags} =~ s/,/ /g; $row->{build_flags} =~ s/_PC\b//g; $row->{build_flags} = lc($row->{build_flags}); + if (defined($row->{log_text})) { # convert to a hash, find ranges, output list of ranges my $h = { split /\s+/, $row->{log_text} }; @@ -85,23 +89,29 @@ while (my $row = $sth->fetchrow_hashref) { if ($h->{$k} ne $h->{$start}) { + # The result (skiped, Passed, Failed) for this testcase number + # is different to the start one of the range. Reset the + # start and the count, for a new range. push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); $start = $k; $i = 1; } else { + # bump the size of this range $i++; } } else { + # First ever range for this row $start = $k; $i = 1; } } if (defined $start) { + # add text for the range to list of ranges push @ranges, sprintf("%s %s %s", $h->{$start}, $start, $i); } -- 2.30.2