browser: tweak and update support scores
authorMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Feb 2015 08:40:30 +0000 (09:40 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 5 Feb 2015 21:46:21 +0000 (22:46 +0100)
Account for new disabled flag.

browser.plp

index 04599d01b14377465b285b8b0df3b645e17e08c9..85ee802e046a8efcd99992694e3541a2f2ab186c 100644 (file)
@@ -61,6 +61,12 @@ my %DSTATS = (
                );
        },
 );
+my %PSTATS = (  # score percentage
+       y => 1,  'y x' => .9,
+       a => .5, 'a x' => .5, 'a d' => .1,
+       j => .2, 'p j' => .2, 'n d' => .2, 'n x d' => .2,
+       p => .2, 'p p' => .2, 'p d' => .1,
+);
 my %CSTATUS = (
        unoff => 'l1', # unofficial
        wd    => 'l2', # draft
@@ -257,14 +263,13 @@ say '</tfoot>';
 
 sub featurescore {
        # relative amount of support for given feature
-       state $statspts = { y=>1, 'y x'=>1, a=>.5, 'a x'=>.5, j=>.2, 'p j'=>.2, 'p p'=>.2, p=>.1 };
        my $rank = 0;
        if (my $row = shift) {
                if ($canihas) {
                        while (my ($browser, $versions) = each %$row) {
                                ref $versions eq 'HASH' or next;
                                while (my ($version, $_) = each %$versions) {
-                                       $rank += ($canihas->{$browser}->{$version} || .001) * $statspts->{$_};
+                                       $rank += ($canihas->{$browser}->{$version} || .001) * $PSTATS{$_};
                                }
                        }
                        return $rank;
@@ -282,7 +287,7 @@ sub featurescore {
                                }
                                splice @vers, -1, 0, @future;  # move ahead to decrease precedence
                        }
-                       $rank += $statspts->{$_} * 2**($div--) for reverse @vers;
+                       $rank += $PSTATS{$_} * 2**($div--) for reverse @vers;
                }
        }
        return $rank;