修复多人游戏成绩上传报错

This commit is contained in:
咕谷酱
2025-08-22 02:26:39 +08:00
parent cc4ad91b40
commit 71e5f1815e
2 changed files with 51 additions and 17 deletions

View File

@@ -292,6 +292,9 @@ class ScoreResp(ScoreBase):
@classmethod
async def from_db(cls, session: AsyncSession, score: Score) -> "ScoreResp":
# 确保 score 对象完全加载,避免懒加载问题
await session.refresh(score)
s = cls.model_validate(score.model_dump())
assert score.id
await score.awaitable_attrs.beatmap