From 44fb6037cf5102294f603ddffe1294ab2646a440 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sat, 29 Jun 2024 00:08:11 -0400 Subject: [PATCH] chuni: add missing alembic script --- changelog.md | 4 +++ .../745448d83696_chuni_team_points.py | 28 +++++++++++++++++++ titles/chuni/base.py | 2 +- titles/chuni/schema/profile.py | 2 +- 4 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 core/data/alembic/versions/745448d83696_chuni_team_points.py diff --git a/changelog.md b/changelog.md index 17fef90..8f60130 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,10 @@ # Changelog Documenting updates to ARTEMiS, to be updated every time the master branch is pushed to. +## 20240629 +### CHUNITHM ++ Add team points + ## 20240628 ### maimai + Add present support diff --git a/core/data/alembic/versions/745448d83696_chuni_team_points.py b/core/data/alembic/versions/745448d83696_chuni_team_points.py new file mode 100644 index 0000000..2a8465a --- /dev/null +++ b/core/data/alembic/versions/745448d83696_chuni_team_points.py @@ -0,0 +1,28 @@ +"""chuni_team_points + +Revision ID: 745448d83696 +Revises: 5ea363686347 +Create Date: 2024-06-29 00:05:22.479187 + +""" +from alembic import op +import sqlalchemy as sa +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = '745448d83696' +down_revision = '5ea363686347' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('chuni_profile_team', sa.Column('userTeamPoint', sa.JSON(), nullable=True)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('chuni_profile_team', 'userTeamPoint') + # ### end Alembic commands ### diff --git a/titles/chuni/base.py b/titles/chuni/base.py index d9d35cc..9be4bf7 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -737,7 +737,7 @@ class ChuniBase: team_name = team["teamName"] team_rank = await self.data.profile.get_team_rank(team["id"]) team_point = team["teamPoint"] - if team["userTeamPoint"] is not None and team["userTeamPoint"] is not "": + if team["userTeamPoint"] is not None and team["userTeamPoint"] != "": user_team_point_data = json.loads(team["userTeamPoint"]) for user_point_data in user_team_point_data: if user_point_data["user"] == data["userId"]: diff --git a/titles/chuni/schema/profile.py b/titles/chuni/schema/profile.py index daa7f4a..f0b8c0f 100644 --- a/titles/chuni/schema/profile.py +++ b/titles/chuni/schema/profile.py @@ -718,7 +718,7 @@ class ChuniProfileData(BaseData): ) return False user_team_point_data = [] - if existing_team["userTeamPoint"] is not None and existing_team["userTeamPoint"] is not "": + if existing_team["userTeamPoint"] is not None and existing_team["userTeamPoint"] != "": user_team_point_data = json.loads(existing_team["userTeamPoint"]) updated = False