pridanie rebricka (leaderboard)
Nova polozka menu Rebricek a stranka /leaderboard: top 10 podla najlepsej hry (hry len s ludmi / s aspon jednym botom) a podla hodin v hre (hry do 3 h). Backend api/leaderboard.py + socket udalost get_leaderboard, testy v tests/test_history.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019YzEAACE9VgnLtXPuWGjwy
This commit is contained in:
1 parent
4000da0454
commit
04846aee26
11 files changed
+614
-12
No files matched your search
+12
-1
@@ -12,7 +12,7 @@ import socketio
|
||||
|
||||
from bridzik import Bridzik, BridzikException, Card
|
||||
from db.db import init_db
|
||||
from api import auth as auth_module, history
|
||||
from api import auth as auth_module, history, leaderboard
|
||||
from api import bots as bots_module
|
||||
from api import stats as stats_module
|
||||
from api.auth import AuthError, RegistrationIncomplete
|
||||
@@ -1016,3 +1016,14 @@ async def get_game_detail(sid, gid):
|
||||
if detail is None:
|
||||
return await send_error(sid, "Hra neexistuje.")
|
||||
await sio.emit("get_game_detail", detail, to=sid)
|
||||
|
||||
|
||||
# --- leaderboard (read-only) ----------------------------------------------
|
||||
|
||||
@sio.on("get_leaderboard")
|
||||
async def get_leaderboard(sid, *args):
|
||||
account = accounts.get(sid)
|
||||
if account is None:
|
||||
return await send_error(sid, "Musíte byť prihlásený.")
|
||||
data = await leaderboard.get_leaderboard(account["player_id"])
|
||||
await sio.emit("get_leaderboard", data, to=sid)
|
||||
Reference in new issue
Block a user