chiark
/
gitweb
/
~ian
/
appendix-a6.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
af19a43
)
compute-scottish-stv: prep for --for-compare to list winners too (nfc)
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:32 +0000
(13:46 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:32 +0000
(13:46 +0100)
compute-scottish-stv
patch
|
blob
|
history
diff --git
a/compute-scottish-stv
b/compute-scottish-stv
index 12645fd4d64da0ce5b13aea6f435afc48c8935d9..40a6667e4322b109be33a666c78eaf4524f5cdb9 100755
(executable)
--- a/
compute-scottish-stv
+++ b/
compute-scottish-stv
@@
-209,16
+209,18
@@
sub prf {
}
sub countballots () {
}
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};
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;
}
}
- 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};
}
}
prf "candidate %-10s: %s votes\n", $c->{Cand}, sv $c->{Total};
}
}