-
-
Save FROGGS/bf3174f484b3458fc4a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $sth = $dbh.prepare('SELECT id,grade,distname,distauth,distver,compver,backend,osname,osver,arch | |
FROM reports | |
ORDER BY id DESC'); | |
$sth.execute; | |
my @reports; | |
my @osnames = <linux win32 macosx netbsd openbsd freebsd solaris>; | |
my %stats; | |
my int $i = 0; | |
while $sth.fetchrow_hashref -> $/ { | |
%stats{$<compver>}{$<osname>}{$<backend>}{$<grade>}++; | |
@osnames.push: $<osname> unless $<osname> ~~ any @osnames; | |
$<distver> = '0' if $<distver> eq '*'; | |
$<breadcrumb> = '/recent'; | |
@reports.push: recent-line($/) unless ($i = $i + 1) > 1000; | |
} | |
for @osnames -> $osname { | |
for %stats.keys -> $compver is copy { | |
for <moar jvm parrot> -> $backend { | |
my $all = [+] %stats{$compver}{$osname}{$backend}.values; | |
for <PASS FAIL NA NOTESTS> -> $grade { | |
if %stats{$compver}{$osname}{$backend}{$grade} { | |
%stats{$compver}{$osname}{$backend}{$grade} /= $all / 100; | |
if 0 < %stats{$compver}{$osname}{$backend}{$grade} < 2 { | |
%stats{$compver}{$osname}{$backend}{$grade}.=ceiling | |
} | |
else { | |
%stats{$compver}{$osname}{$backend}{$grade}.=floor; | |
} | |
} | |
else { | |
%stats{$compver}{$osname}{$backend}{$grade} = 0 | |
} | |
} | |
my $deviation = 100 - [+] %stats{$compver}{$osname}{$backend}.values; | |
if -10 < $deviation < 10 { | |
my $grade = %stats{$compver}{$osname}{$backend}.sort(*.value).reverse[0].key; | |
%stats{$compver}{$osname}{$backend}{$grade} += $deviation; | |
} | |
} | |
} | |
} | |
main({ | |
:breadcrumb(['Most recent reports']), | |
:content( | |
'<h4>Code quality across operating system, compiler version and backend</h4>' ~ | |
dist({ | |
:stats( stats([@osnames.sort], $%stats, &cell) ), | |
:report-tables( | |
'<h4>Latest 1000 reports</h4>' ~ | |
recent-table({ :report-lines(@reports.join("\n")) }) | |
) | |
}), | |
), | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment