diff --git a/tlapbot/__init__.py b/tlapbot/__init__.py index e1c619f..4bc5e57 100644 --- a/tlapbot/__init__.py +++ b/tlapbot/__init__.py @@ -51,6 +51,7 @@ def create_app(test_config=None): db.init_app(app) app.cli.add_command(db.clear_queue_command) app.cli.add_command(db.refresh_counters_command) + app.cli.add_command(db.refresh_and_clear_command) # scheduler job for giving points to users def proxy_job(): diff --git a/tlapbot/db.py b/tlapbot/db.py index 21aec9e..428c9b9 100644 --- a/tlapbot/db.py +++ b/tlapbot/db.py @@ -106,6 +106,15 @@ def refresh_counters_command(): click.echo('Counters refreshed.') +@click.command('clear-refresh') +@with_appcontext +def refresh_and_clear_command(): + """Refresh counters and clear queue.""" + refresh_counters() + clear_redeem_queue() + click.echo('Counters refreshed and queue cleared.') + + def init_app(app): app.teardown_appcontext(close_db) app.cli.add_command(init_db_command)