diff --git a/app/database/beatmap.py b/app/database/beatmap.py index d3ba940..e6f82e5 100644 --- a/app/database/beatmap.py +++ b/app/database/beatmap.py @@ -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() diff --git a/app/database/playlist_attempts.py b/app/database/playlist_attempts.py index 5d580cf..e628008 100644 --- a/app/database/playlist_attempts.py +++ b/app/database/playlist_attempts.py @@ -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"], )