fix critical bugs
This commit is contained in:
parent
0de0deb14f
commit
20f96d0e0a
3 changed files with 11 additions and 9 deletions
|
|
@ -648,8 +648,8 @@ class StatsService:
|
|||
since_ms = since_timestamp * 1000
|
||||
until_ms = until_timestamp * 1000
|
||||
|
||||
# Получаем игры
|
||||
games = await self.lichess_client.get_games_of_period(username, since_ms, until_ms, rated_only)
|
||||
# Получаем игры (без фильтра rated в запросе к Lichess — см. lichess_client)
|
||||
games = await self.lichess_client.get_games_of_period(username, since_ms, until_ms, rated_only=False)
|
||||
|
||||
if games is None:
|
||||
return GamesOfPeriodResponse(
|
||||
|
|
@ -660,6 +660,10 @@ class StatsService:
|
|||
games_count=0
|
||||
)
|
||||
|
||||
# Фильтр по рейтинговости на нашей стороне (API Lichess с param rated даёт неверный результат)
|
||||
if rated_only:
|
||||
games = [g for g in games if g.get('rated') is True]
|
||||
|
||||
if not games:
|
||||
return GamesOfPeriodResponse(
|
||||
message=f"Игры за указанный период не найдены",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue