diff --git a/pyRCV2/cli/stv.py b/pyRCV2/cli/stv.py index 22ec3ea..7021a18 100644 --- a/pyRCV2/cli/stv.py +++ b/pyRCV2/cli/stv.py @@ -20,6 +20,7 @@ import pyRCV2.numbers from pyRCV2.method.gregory import UIGSTVCounter, WIGSTVCounter, EGSTVCounter from pyRCV2.method.meek import MeekSTVCounter +from pyRCV2.model import CandidateState from pyRCV2.ties import TiesBackwards, TiesForwards, TiesPrompt, TiesRandom import sys @@ -142,6 +143,10 @@ def main(args): counter.options['bulk_elect'] = not args.no_bulk_elect counter.options['papers'] = 'transferable' if args.transferable_only else 'both' + # Print report + print('Count computed by pyRCV2 (development version). Read {} ballots from "{}" for election "{}". There are {} candidates for {} vacancies. Counting using options "{}".'.format(sum((b.value for b in election.ballots), pyRCV2.numbers.Num(0)).pp(0), args.file, election.name, len(election.candidates), election.seats, counter.describe_options())) + print() + # Reset stage = 1 result = counter.reset() @@ -157,3 +162,7 @@ def main(args): break print_step(args, stage, result) + + print('Count complete. The winning candidates are, in order of election:') + for x in sorted(((c, cc) for c, cc in result.candidates.items() if cc.state == CandidateState.ELECTED), key=lambda x: x[1].order_elected): + print('{}. {}'.format(x[1].order_elected , x[0].name))