termcol: make rules to setup xcolors checkout
[sheet.git] / browser.plp
index 5c3f769dcbc34ef88343d8845b9212d1c3d44059..c890052b866f8e85f7a80f424a8b78755c7bf88a 100644 (file)
@@ -193,11 +193,11 @@ $canihas ||= {
        } @browsers
 }; # fallback hash based on release semantics
 
-my $usagepct = 1;  # score multiplier for 0..100 result
-# normalise usage percentage to only include shown browsers
-$usagepct = 100.01 / featurescore({  # yes for every possible version
-       map { $_ => { map {$_ => 'y'} map { @{$_} } @{$versions{$_}} } } keys %versions
-});
+# score multiplier for percentage of all browser versions
+my $usagepct = 99.99 / sum(
+       map { $_->{-total} // values %{$_} } values %{$canihas}
+);
+
 $_->{usage} = featurescore($_->{stats}) * $usagepct
        for values %{ $caniuse->{data} };
 
@@ -455,9 +455,9 @@ say '</table>';
 
 sub paddedver {
        # normalised version number comparable as string (cmp)
-       shift =~ /(?:.*-|^)(\d*)(.*)/;
+       $_[0] =~ m/(?:.*-|^)(\d*)(.*)/;
        # matched (major)(.minor) of last value in range (a-B)
-       return sprintf('%02d', $1 || 99) . $2;
+       return sprintf('%02d', length $1 ? $1 : 99) . $2;
 }
 
 sub showversions {