browser: prefer last stable release in versions row
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 27 Apr 2017 15:42:30 +0000 (17:42 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 29 May 2017 17:21:27 +0000 (19:21 +0200)
browser.plp

index 8ff9886..b06d8e9 100644 (file)
@@ -237,16 +237,16 @@ print '<thead>', $header;
 print "\n<tr>";
 for my $browser (@browsers) {
        for (@{ $versions{$browser} }) {
-               my $lastver = $_->[-1];
-               my $release = $caniuse->{agents}->{$browser}->{verrelease}->{$lastver};
-               my $future = defined $release;
+               my $lastver = first {
+                       !defined $caniuse->{agents}->{$browser}->{verrelease}->{$_} # stable
+               } reverse @{$_};
                printf('<td title="%s"%s>%s',
                        join(' ',
                                sprintf('%.1f%%', sum(@{ $canihas->{$browser} }{@$_}) * $usagepct),
                                'version ' . showversions(@{$_}, undef),
-                               $future ? '(development)' : (),
+                               $_->[-1] eq $lastver ? () : '(development)',
                        ),
-                       $future && ' class="ex"',
+                       !defined $lastver && ' class="ex"',
                        showversions($lastver),
                );
        }