From 74893eb17a71ef9a0626be1237d1a5c5b84bcadb Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 23 Aug 2016 13:46:32 +0100 Subject: [PATCH] compute-scottish-stv: prep for --for-compare to list winners too (nfc) --- compute-scottish-stv | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/compute-scottish-stv b/compute-scottish-stv index 12645fd..40a6667 100755 --- a/compute-scottish-stv +++ b/compute-scottish-stv @@ -209,16 +209,18 @@ sub prf { } 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; } - 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}; } } -- 2.30.2