diff options
Diffstat (limited to 'countify')
-rwxr-xr-x | countify | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -53,8 +53,9 @@ where <command> is one of: --rank Show ranking based on master ballot --help Show this help message --version Show version information + --force Collect even if the election is not yet closed. -and <election> is one of the elections currently in-progress. The following +and <election> is one of the elections currently in-progress or recently closed. The following elections are currently open: $usage_elections @@ -79,13 +80,18 @@ my ($result) = GetOptions( 'rank', # show the ranking based on a master ballot 'help', # help message 'version', # version information + 'force', # collect on not-closed election ); if ($opt{'help'} or not %opt) { print STDERR $usage; exit 0 } if ($opt{'version'}) { print STDERR $version; exit 0 } -die "$zero: only one command allowed; use --help for help\n" if 1 < keys %opt; +die "$zero: only one command allowed; use --help for help\n" if List::Util::sum($opt{'collect'} || 0, $opt{'rank'} || 0, $opt{'help'} || 0, $opt{'version'} || 0) != 1; die "$zero: election required; use --help for help\n" unless @ARGV == 1; my ($election) = $ARGV[0]; +my $election_ref = Votify::get_single_election_hashref($election, 0); +if(%$election_ref{'valid'} && not defined $opt{'force'}) { + die "$zero: election $election is still open. Pass --force to count anyway." +} my ($vl) = VoterList->new($election); if ($opt{'collect'}) { |