standardization KaleidxScope variable names
parent
cc7afa6b67
commit
9a7fc007bc
|
@ -284,8 +284,8 @@ class Mai2DX(Mai2Base):
|
|||
|
||||
# added in PRiSM
|
||||
if "userKaleidxScopeList" in upsert and len(upsert["userKaleidxScopeList"]) > 0:
|
||||
for kaleidx_scope in upsert["userKaleidxScopeList"]:
|
||||
await self.data.score.put_user_kaleidx_scope(user_id, kaleidx_scope)
|
||||
for kaleidxscope in upsert["userKaleidxScopeList"]:
|
||||
await self.data.score.put_user_kaleidxscope(user_id, kaleidxscope)
|
||||
|
||||
|
||||
return {"returnCode": 1, "apiName": "UpsertUserAllApi"}
|
||||
|
|
|
@ -4,7 +4,6 @@ from core.config import CoreConfig
|
|||
from titles.mai2.buddiesplus import Mai2BuddiesPlus
|
||||
from titles.mai2.const import Mai2Constants
|
||||
from titles.mai2.config import Mai2Config
|
||||
from titles.mai2.schema.score import kaleidx_scope
|
||||
|
||||
|
||||
class Mai2Prism(Mai2BuddiesPlus):
|
||||
|
@ -50,18 +49,18 @@ class Mai2Prism(Mai2BuddiesPlus):
|
|||
}
|
||||
|
||||
async def handle_get_user_kaleidx_scope_api_request(self, data: Dict) -> Dict:
|
||||
kaleidx_scope = await self.data.score.get_user_kaleidx_scope_list(data["userId"])
|
||||
kaleidxscope = await self.data.score.get_user_kaleidxscope_list(data["userId"])
|
||||
|
||||
if kaleidx_scope is None:
|
||||
if kaleidxscope is None:
|
||||
return {"userId": data["userId"], "userKaleidxScopeList":[]}
|
||||
|
||||
kaleidx_scope_list = []
|
||||
for kaleidx_scope_data in kaleidx_scope:
|
||||
tmp = kaleidx_scope_data._asdict()
|
||||
kaleidxscope_list = []
|
||||
for kaleidxscope_data in kaleidxscope:
|
||||
tmp = kaleidxscope_data._asdict()
|
||||
tmp.pop("user")
|
||||
tmp.pop("id")
|
||||
kaleidx_scope_list.append(tmp)
|
||||
kaleidxscope_list.append(tmp)
|
||||
return {
|
||||
"userId": data["userId"],
|
||||
"userKaleidxScopeList": kaleidx_scope_list
|
||||
"userKaleidxScopeList": kaleidxscope_list
|
||||
}
|
|
@ -175,8 +175,8 @@ playlog_2p = Table(
|
|||
mysql_charset="utf8mb4",
|
||||
)
|
||||
|
||||
kaleidx_scope = Table(
|
||||
"mai2_score_kaleidx_scope",
|
||||
kaleidxscope = Table(
|
||||
"mai2_score_kaleidxscope",
|
||||
metadata,
|
||||
Column("id", Integer, primary_key=True, nullable=False),
|
||||
Column(
|
||||
|
@ -481,21 +481,21 @@ class Mai2ScoreData(BaseData):
|
|||
return None
|
||||
return result.scalar()
|
||||
|
||||
async def get_user_kaleidx_scope_list(self, user_id: int) -> Optional[List[Row]]:
|
||||
sql = kaleidx_scope.select(kaleidx_scope.c.user == user_id)
|
||||
async def get_user_kaleidxscope_list(self, user_id: int) -> Optional[List[Row]]:
|
||||
sql = kaleidxscope.select(kaleidxscope.c.user == user_id)
|
||||
result = await self.execute(sql)
|
||||
if result is None:
|
||||
return None
|
||||
return result.fetchall()
|
||||
|
||||
async def put_user_kaleidx_scope(self, user_id: int, user_kaleidx_scope_data: Dict) -> Optional[int]:
|
||||
user_kaleidx_scope_data["user"] = user_id
|
||||
sql = insert(kaleidx_scope).values(**user_kaleidx_scope_data)
|
||||
async def put_user_kaleidxscope(self, user_id: int, user_kaleidxscope_data: Dict) -> Optional[int]:
|
||||
user_kaleidxscope_data["user"] = user_id
|
||||
sql = insert(kaleidxscope).values(**user_kaleidxscope_data)
|
||||
|
||||
conflict = sql.on_duplicate_key_update(**user_kaleidx_scope_data)
|
||||
conflict = sql.on_duplicate_key_update(**user_kaleidxscope_data)
|
||||
|
||||
result = await self.execute(conflict)
|
||||
if result is None:
|
||||
self.logger.error(f"put_user_kaleidx_scope: Failed to insert! user_id {user_id}")
|
||||
self.logger.error(f"put_user_kaleidxscope: Failed to insert! user_id {user_id}")
|
||||
return None
|
||||
return result.lastrowid
|
Loading…
Reference in New Issue