}
sub countballots () {
+ my @pr;
+
foreach my $c (values %cands) {
next if $c->{NonCont};
$c->{Total} = 0/1;
$c->{Total} += $_->{Weight} foreach @{ $c->{Votes} };
print DEBUG "counted $c->{Cand} $c->{Total}\n";
$c->{History}[$stage-1] = $c->{Total};
+ push @pr, $c;
+ }
+
+ if ($for_compare) {
+ # for comparison with OpenSTV, which always prints
+ # the quota for every elected candidate
+ push @pr, { %$_, Total => $quota } foreach @elected;
}
- foreach my $c (reverse sort $display_cmp
- grep { !$_->{NonCont} } values %cands) {
+ foreach my $c (reverse sort $display_cmp @pr) {
prf "candidate %-10s: %s votes\n", $c->{Cand}, sv $c->{Total};
}
}