X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fpocket-devotee;h=232f316c57c1b21e63df105784faa2bb17db7323;hb=HEAD;hp=88c79e557318b04a91aa431453db9c0ae2edbc1a;hpb=4b0217f695c0d0a686be63aa68feb71496ed57a5;p=debian-ctte.git diff --git a/scripts/pocket-devotee b/scripts/pocket-devotee index 88c79e5..232f316 100755 --- a/scripts/pocket-devotee +++ b/scripts/pocket-devotee @@ -108,7 +108,7 @@ sub main { } my @options; for my $option (@{$options{option}}) { - my ($key,$name,$majority) = $option =~ /^\s*([^:]+)\s*:\s*(.+?)\s*(?::(\d+))?$/; + my ($key,$name,$majority) = $option =~ /^\s*([^:]+?)\s*:\s*(.+?)\s*(?::(\d+))?$/; $majority //= 1; push @options,{key => $key, name => $name, @@ -340,12 +340,12 @@ 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} and $Beat_Matrix[$i][$max_choices - 1] or $ratio <= 1) { + if ($ratio < $order_to_options{$i + 1}{majority} 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)"; - my $comparison_sign = $order_to_options{$i + 1}{majority} == 1 ? '<' : '<='; + 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], @@ -353,7 +353,8 @@ EOM } else { print {$RESULTS} "Option ", $order_to_options{$i + 1}{key}, " passes Majority."; print {$RESULTS} " "; - 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};