From 3b153d418434256a11da00ed8d3f7b4ff2562dee Mon Sep 17 00:00:00 2001 From: terry3041 Date: Sat, 23 Mar 2024 01:26:47 +0800 Subject: [PATCH] Revert "push" This reverts commit 78cad38e15f108795d30effd90a9182ef033ccc4. --- dbutils.py | 6 +++++- titles/chuni/base.py | 21 ++++++++++++++++----- titles/chuni/schema/profile.py | 32 ++++++++++++++++++++++---------- titles/ongeki/schema/profile.py | 11 ++++++----- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/dbutils.py b/dbutils.py index 32c788e..541b4d3 100644 --- a/dbutils.py +++ b/dbutils.py @@ -28,11 +28,15 @@ if __name__ == "__main__": default="00000000000000000000", ) parser.add_argument("--message", "-m", type=str, help="Revision message") +<<<<<<< Updated upstream + parser.add_argument("action", type=str, help="create, upgrade, downgrade, create-owner, migrate, create-revision, create-autorevision") +======= parser.add_argument( "action", type=str, - help="create, upgrade, downgrade, create-owner, migrate, create-revision, create-autorevision", + help="create, upgrade, create-owner, migrate, create-revision", ) +>>>>>>> Stashed changes args = parser.parse_args() cfg = CoreConfig() diff --git a/titles/chuni/base.py b/titles/chuni/base.py index 8b1fb52..0224db0 100644 --- a/titles/chuni/base.py +++ b/titles/chuni/base.py @@ -189,11 +189,9 @@ class ChuniBase: { "id": 1, "type": 1, - "message": ( - f"Welcome to {self.core_cfg.server.name} network!" - if not self.game_cfg.server.news_msg - else self.game_cfg.server.news_msg - ), + "message": f"Welcome to {self.core_cfg.server.name} network!" + if not self.game_cfg.server.news_msg + else self.game_cfg.server.news_msg, "startDate": "2017-12-05 07:00:00.0", "endDate": "2099-12-31 00:00:00.0", } @@ -984,6 +982,18 @@ class ChuniBase: for rp in upsert["userRecentPlayerList"]: pass +<<<<<<< Updated upstream + for rating_type in {"userRatingBaseList", "userRatingBaseHotList", "userRatingBaseNextList"}: + if rating_type not in upsert: + continue + + await self.data.profile.put_profile_rating( + user_id, + self.version, + rating_type, + upsert[rating_type], + ) +======= # added in LUMINOUS if "userCMissionList" in upsert: for cmission in upsert["userCMissionList"]: @@ -1010,6 +1020,7 @@ class ChuniBase: False if net_battle["isRankUpChallengeFailed"] == "false" else True ) await self.data.profile.put_net_battle(user_id, net_battle) +>>>>>>> Stashed changes return {"returnCode": "1"} diff --git a/titles/chuni/schema/profile.py b/titles/chuni/schema/profile.py index 9333a32..71691c2 100644 --- a/titles/chuni/schema/profile.py +++ b/titles/chuni/schema/profile.py @@ -1,4 +1,13 @@ from typing import Dict, List, Optional +<<<<<<< Updated upstream +from sqlalchemy import Table, Column, UniqueConstraint, and_ +from sqlalchemy.types import Integer, String, Boolean, JSON, BigInteger +from sqlalchemy.schema import ForeignKey +from sqlalchemy.engine import Row +from sqlalchemy.sql import select, delete +from sqlalchemy.dialects.mysql import insert +======= +>>>>>>> Stashed changes from core.data.schema import BaseData, metadata from sqlalchemy import Column, Table, UniqueConstraint, and_ @@ -392,6 +401,7 @@ team = Table( mysql_charset="utf8mb4", ) +<<<<<<< Updated upstream rating = Table( "chuni_profile_rating", metadata, @@ -408,12 +418,8 @@ rating = Table( Column("difficultId", Integer), Column("romVersionCode", Integer), Column("score", Integer), - UniqueConstraint( - "user", "version", "type", "index", name="chuni_profile_rating_best_uk" - ), - mysql_charset="utf8mb4", -) - + UniqueConstraint("user", "version", "type", "index", name="chuni_profile_rating_best_uk"), +======= net_battle = Table( "chuni_profile_net_battle", metadata, @@ -424,6 +430,7 @@ net_battle = Table( Column("battleIconId", Integer), Column("battleIconNum", Integer), Column("avatarEffectPoint", Integer), +>>>>>>> Stashed changes mysql_charset="utf8mb4", ) @@ -759,8 +766,11 @@ class ChuniProfileData(BaseData): total_play_count = 0 for row in playcount_sql: total_play_count += row[0] - return {"total_play_count": total_play_count} - +<<<<<<< Updated upstream + return { + "total_play_count": total_play_count + } + async def put_profile_rating( self, aime_id: int, @@ -782,8 +792,9 @@ class ChuniProfileData(BaseData): f"put_profile_rating: Could not insert {rating_type}, aime_id: {aime_id}", ) return - - return result.lastrowid + +======= + return {"total_play_count": total_play_count} async def get_net_battle(self, aime_id: int) -> Optional[Row]: sql = select(net_battle).where(net_battle.c.user == aime_id) @@ -804,4 +815,5 @@ class ChuniProfileData(BaseData): result = await self.execute(conflict) if result is None: return None +>>>>>>> Stashed changes return result.lastrowid diff --git a/titles/ongeki/schema/profile.py b/titles/ongeki/schema/profile.py index 6793c64..937fc72 100644 --- a/titles/ongeki/schema/profile.py +++ b/titles/ongeki/schema/profile.py @@ -262,9 +262,7 @@ rating = Table( Column("difficultId", Integer), Column("romVersionCode", Integer), Column("score", Integer), - UniqueConstraint( - "user", "version", "type", "index", name="ongeki_profile_rating_best_uk" - ), + UniqueConstraint("user", "version", "type", "index", name="ongeki_profile_rating_best_uk"), mysql_charset="utf8mb4", ) @@ -552,7 +550,8 @@ class OngekiProfileData(BaseData): ) else: return result.rowcount - +<<<<<<< Updated upstream + async def put_profile_rating( self, aime_id: int, @@ -574,5 +573,7 @@ class OngekiProfileData(BaseData): f"put_profile_rating_{rating_type}: Could not insert rating entries, aime_id: {aime_id}", ) return - + return result.lastrowid +======= +>>>>>>> Stashed changes