]> git.donarmstrong.com Git - debian-ctte.git/commitdiff
support specifying quorum; keep default at 2
authorDon Armstrong <don@donarmstrong.com>
Sun, 12 Apr 2015 18:37:21 +0000 (11:37 -0700)
committerDon Armstrong <don@donarmstrong.com>
Sun, 12 Apr 2015 18:37:21 +0000 (11:37 -0700)
scripts/pocket-devotee

index d176de8257f8dbeeca5e525e98c7b7fd3c8cb131..9107a0b6d626761f29497f7bb9d42ee5c180eea2 100755 (executable)
@@ -99,6 +99,7 @@ sub main {
     GetOptions(\%options,
                'option=s@',
                'default_option|default-option!',
+               'quorum=i',
               );
     if (not exists $options{option} or not ref($options{option}) or
         @{$options{option}} < 2
@@ -116,6 +117,7 @@ sub main {
     }
     winner(options=>\@options,
            default_option => exists $options{default_option} ? $options{default_option} : 1,
+           quorum => exists $options{quorum} ? $options{quorum} : 2,
           );
 }
 
@@ -163,7 +165,7 @@ sub winner {
   }
 
   # The constitution defines the maximum value of K to be 5
-  my $K = 2; # Math::BigFloat->new($params{quorum});
+  my $K = $params{quorum};
 
   #   1. Given two options A and B, V(A,B) is the number of voters who
   #      prefer option A over option B.