chiark / gitweb /
compute-scottish-stv: prep for --for-compare to list winners too (nfc)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:32 +0000 (13:46 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Tue, 23 Aug 2016 12:46:32 +0000 (13:46 +0100)
compute-scottish-stv

index 12645fd4d64da0ce5b13aea6f435afc48c8935d9..40a6667e4322b109be33a666c78eaf4524f5cdb9 100755 (executable)
@@ -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};
     }
 }