]> git.donarmstrong.com Git - debian-ctte.git/commitdiff
Implement 2015/vote_003 patch on the constitution in pocket-devotee
authorDidier Raboud <odyx@debian.org>
Tue, 12 Jul 2016 19:52:20 +0000 (21:52 +0200)
committerDidier Raboud <odyx@debian.org>
Tue, 12 Jul 2016 19:53:00 +0000 (21:53 +0200)
scripts/pocket-devotee

index 5e7b3ec59058a3f1c798661d3883c86f376a96fc..88c79e557318b04a91aa431453db9c0ae2edbc1a 100755 (executable)
@@ -327,7 +327,8 @@ EOM
 
 
   #   2. An option A defeats the default option D by a majority ratio N,
-  #   if V(A,D) is strictly greater than N * V(D,A).
+  #   if V(A,D) is greater or equal to N * V(D,A) and V(A,D) is strictly
+  #   greater than V(D,A).
   #   3. If a supermajority of S:1 is required for A, its majority ratio
   #   is S; otherwise, its majority ratio is 1.
   #  Any (non-default) option which does not defeat the default option
@@ -339,12 +340,13 @@ EOM
       my $ratio = 1.0 * $Beat_Matrix[$i][$max_choices - 1] /
           $Beat_Matrix[$max_choices - 1][$i];
       $Ratio{$i} = sprintf("%.2f", $ratio);
-      if ($ratio < $order_to_options{$i + 1}{majority}) {
+      if ($ratio < $order_to_options{$i + 1}{majority} and $Beat_Matrix[$i][$max_choices - 1] or $ratio <= 1) {
           # If the next line is commented out, we get a more verbose set of results
           $Drop{$i}++;
           print {$RESULTS} "Dropping Option ", $order_to_options{$i + 1}{key},
               " because of Majority. ($ratio)";
-          printf {$RESULTS} " %6.3f (%d/%d) < %d\n",
+          my $comparison_sign = $order_to_options{$i + 1}{majority} == 1 ? '<' : '<=';
+          printf {$RESULTS} " %6.3f (%d/%d) $comparison_sign %d\n",
               $ratio, $Beat_Matrix[$i][$max_choices - 1],
               $Beat_Matrix[$max_choices - 1][$i],
               $order_to_options{$i + 1}{majority};