fix(beatmap,playlist): missing greetlet

This commit is contained in:
MingxuanGame
2025-08-10 13:31:08 +00:00
parent b12782abe0
commit 1891496832
2 changed files with 4 additions and 3 deletions

View File

@@ -157,8 +157,8 @@ class BeatmapResp(BeatmapBase):
) -> "BeatmapResp":
from .score import Score
beatmap_status = beatmap.beatmap_status
beatmap_ = beatmap.model_dump()
beatmap_status = beatmap_["beatmap_status"]
if query_mode is not None and beatmap.mode != query_mode:
beatmap_["convert"] = True
beatmap_["is_scoreable"] = beatmap_status.has_leaderboard()

View File

@@ -2,6 +2,7 @@ from .lazer_user import User, UserResp
from .playlist_best_score import PlaylistBestScore
from pydantic import BaseModel
from sqlalchemy.ext.asyncio import AsyncAttrs
from sqlmodel import (
BigInteger,
Column,
@@ -28,7 +29,7 @@ class ItemAttemptsCountBase(SQLModel):
total_score: int = 0
class ItemAttemptsCount(ItemAttemptsCountBase, table=True):
class ItemAttemptsCount(AsyncAttrs, ItemAttemptsCountBase, table=True):
__tablename__ = "item_attempts_count" # pyright: ignore[reportAssignmentType]
id: int | None = Field(default=None, primary_key=True)
@@ -105,7 +106,7 @@ class ItemAttemptsResp(ItemAttemptsCountBase):
) -> "ItemAttemptsResp":
resp = cls.model_validate(item_attempts.model_dump())
resp.user = await UserResp.from_db(
item_attempts.user,
await item_attempts.awaitable_attrs.user,
session=session,
include=["statistics", "team", "daily_challenge_user_stats"],
)