From 70fea0210081462dcf7508db1b4ba5eefa1f11e9 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Wed, 29 Nov 2017 16:52:55 +1100 Subject: [PATCH] Allow selecting which election to manipulate from the CLI --- eosweb/core/main.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/eosweb/core/main.py b/eosweb/core/main.py index fcce2cd..dd5b950 100644 --- a/eosweb/core/main.py +++ b/eosweb/core/main.py @@ -135,16 +135,25 @@ def setup_test_election(): election.save() -@app.cli.command('close_test_election') -def close_test_election(): - election = Election.get_all()[0] +@app.cli.command('close_election') +@click.option('--electionid', default=None) +def close_election(electionid): + if electionid is None: + election = Election.get_all()[0] + else: + election = Election.get_by_id(electionid) + election.workflow.get_task('eos.base.workflow.TaskCloseVoting').enter() election.save() -@app.cli.command('count_test_election') -def count_test_election(): - election = Election.get_all()[0] +@app.cli.command('count_election') +@click.option('--electionid', default=None) +def count_election(electionid): + if electionid is None: + election = Election.get_all()[0] + else: + election = Election.get_by_id(electionid) # Mix votes election.workflow.get_task('eos.psr.workflow.TaskMixVotes').enter()