cxb: add grade to playlog

This commit is contained in:
Hay1tsme 2024-05-28 22:32:38 -04:00
parent 12f035b7e5
commit a2fe83ae06
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,28 @@
"""cxb_add_playlog_grade
Revision ID: 7dc13e364e53
Revises: 2d024cf145a1
Create Date: 2024-05-28 22:31:22.264926
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '7dc13e364e53'
down_revision = '2d024cf145a1'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('cxb_playlog', sa.Column('grade', sa.Integer(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('cxb_playlog', 'grade')
# ### end Alembic commands ###

View File

@ -40,6 +40,7 @@ class CxbRev(CxbBase):
score_data["slow2"],
score_data["fail"],
score_data["combo"],
score_data["grade"],
)
return {"data": True}
return {"data": True}

View File

@ -39,6 +39,7 @@ playlog = Table(
Column("slow2", Integer),
Column("fail", Integer),
Column("combo", Integer),
Column("grade", Integer),
Column("date_scored", TIMESTAMP, server_default=func.now()),
mysql_charset="utf8mb4",
)
@ -104,6 +105,7 @@ class CxbScoreData(BaseData):
this_slow2: int,
fail: int,
combo: int,
grade: int,
) -> Optional[int]:
"""
Add an entry to the user's play log
@ -123,6 +125,7 @@ class CxbScoreData(BaseData):
slow2=this_slow2,
fail=fail,
combo=combo,
grade=grade,
)
result = await self.execute(sql)