Skip to content

Commit

Permalink
🐛 修爆炸
Browse files Browse the repository at this point in the history
  • Loading branch information
shoucandanghehe committed Dec 20, 2024
1 parent d4b690f commit 9c28c3d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from ..base import ArCounts, FailedModel, P, SuccessModel


class League(BaseModel):
class BaseLeague(BaseModel):
gamesplayed: int
gameswon: int
tr: float
Expand All @@ -16,21 +16,28 @@ class League(BaseModel):
bestrank: ValidRank
glicko: float
rd: float
apm: float
pps: float
vs: float
decaying: bool


class Entry(BaseModel):
class InvalidLeague(BaseLeague):
apm: None
vs: None


class League(BaseLeague):
apm: float
vs: float


class BaseEntry(BaseModel):
id: str = Field(..., alias='_id')
username: str
role: Literal['anon', 'user', 'bot', 'halfmod', 'mod', 'admin', 'sysop']
ts: datetime | None = None
xp: float
country: str | None = None
supporter: bool | None = None
league: League
gamesplayed: int
gameswon: int
gametime: float
Expand All @@ -39,8 +46,16 @@ class Entry(BaseModel):
p: P


class InvalidEntry(BaseEntry):
league: InvalidLeague


class Entry(BaseEntry):
league: League


class Data(BaseModel):
entries: list[Entry]
entries: list[Entry | InvalidEntry]


class BySuccessModel(SuccessModel):
Expand Down
2 changes: 1 addition & 1 deletion nonebot_plugin_tetris_stats/games/tetrio/rank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ async def get_tetra_league_data() -> None:

players: list[Entry] = []
for result in results:
players.extend(result.data.entries)
players.extend([i for i in result.data.entries if isinstance(i, Entry)])
players.sort(key=lambda x: x.league.tr, reverse=True)

rank_player_mapping: defaultdict[Rank, list[Entry]] = defaultdict(list)
Expand Down

0 comments on commit 9c28c3d

Please sign in to comment.