Skip to content

Commit

Permalink
Add test chat message on aouto pairing submit/cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
gbtami committed Dec 25, 2024
1 parent 12b247d commit 729c581
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions server/wsl.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from __future__ import annotations
import asyncio
import logging
from time import time

import aiohttp_session
from aiohttp import web
Expand All @@ -25,6 +26,7 @@
from misc import server_state
from newid import new_id
from const import TYPE_CHECKING
from settings import DEV

if TYPE_CHECKING:
from pychess_global_app_state import PychessGlobalAppState
Expand Down Expand Up @@ -365,12 +367,27 @@ async def handle_cancel_auto_pairing(app_state, ws, user, data):
for user_ws in user.lobby_sockets:
await ws_send_json(user_ws, {"type": "auto_pairing_off"})

if DEV:
msg = "Auto pairing cancelled."
await app_state.lobby.lobby_chat("server", "%s: %s" % (user.username, msg), int(time()))


async def handle_create_auto_pairing(app_state, ws, user, data):
no = await send_game_in_progress_if_any(app_state, user, ws)
if no:
return

if DEV:
variants = ",".join((v[0] + ("960" if v[1] else "") for v in data["variants"]))
msg = "%s: %s %s %s %s" % (
user.username,
variants,
data["tcs"],
data["rrmin"],
data["rrmax"],
)
await app_state.lobby.lobby_chat("server", msg, int(time()))

auto_variant_tc, matching_user, matching_seek = add_to_auto_pairings(app_state, user, data)

auto_paired = False
Expand Down

0 comments on commit 729c581

Please sign in to comment.