Add right/wrong marking with steal mechanism and question stats

Adds Correct/Wrong buttons to admin panel that track question
answer stats across games and implement a steal system where
the next team gets one chance to answer if the first team is wrong.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-03 14:40:58 -04:00
parent cf0937763b
commit 46d45eebb6
7 changed files with 262 additions and 16 deletions

View File

@@ -93,6 +93,7 @@ def run_migrations_online():
conf_args = current_app.extensions['migrate'].configure_args
if conf_args.get("process_revision_directives") is None:
conf_args["process_revision_directives"] = process_revision_directives
conf_args.pop("render_as_batch", None)
connectable = get_engine()

View File

@@ -0,0 +1,44 @@
"""Add question stats and game steal state
Revision ID: 7b4626ec6a70
Revises: 9a119272b516
Create Date: 2026-04-03 14:39:34.805437
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import sqlite
# revision identifiers, used by Alembic.
revision = '7b4626ec6a70'
down_revision = '9a119272b516'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('games', schema=None) as batch_op:
batch_op.add_column(sa.Column('steal_active', sa.Boolean(), nullable=True))
batch_op.drop_column('is_steal_mode')
batch_op.drop_column('turn_order')
with op.batch_alter_table('questions', schema=None) as batch_op:
batch_op.add_column(sa.Column('times_correct', sa.Integer(), nullable=False, server_default='0'))
batch_op.add_column(sa.Column('times_incorrect', sa.Integer(), nullable=False, server_default='0'))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('questions', schema=None) as batch_op:
batch_op.drop_column('times_incorrect')
batch_op.drop_column('times_correct')
with op.batch_alter_table('games', schema=None) as batch_op:
batch_op.add_column(sa.Column('turn_order', sqlite.JSON(), nullable=True))
batch_op.add_column(sa.Column('is_steal_mode', sa.BOOLEAN(), nullable=True))
batch_op.drop_column('steal_active')
# ### end Alembic commands ###