From 036babec3e9f93822b808a7a62dcf9485ddf3307 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 29 Sep 2024 01:36:11 +0200 Subject: Be more robust when deleting accounts. Leave player assignment to not mess with Elo ratings and tournament data. Reset ctime when game is actually started. --- public/join.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'public/join.js') diff --git a/public/join.js b/public/join.js index 20a95e7..75e7aca 100644 --- a/public/join.js +++ b/public/join.js @@ -275,6 +275,8 @@ function user_link(user_name) { } function player_link(player) { + if (!player.name) + return "null" let link = user_link(player.name) if (player.is_invite) link = "" + link + " ?" @@ -332,11 +334,18 @@ function create_game_list() { create_game_list_item(list, "Pace", PACE_TEXT[game.pace]) create_game_list_item(list, "Notice", game.notice) - if (game.owner_id) - create_game_list_item(list, "Created", human_date(game.ctime) + " by " + user_link(game.owner_name)) - else - create_game_list_item(list, "Created", human_date(game.ctime)) + if (game.status === 0) { + if (game.owner_id) + create_game_list_item(list, "Created", human_date(game.ctime) + " by " + user_link(game.owner_name)) + else + create_game_list_item(list, "Created", human_date(game.ctime)) + } else { + if (game.owner_id) + create_game_list_item(list, "Started", human_date(game.ctime) + " by " + user_link(game.owner_name)) + else + create_game_list_item(list, "Started", human_date(game.ctime)) + } create_game_list_item(list, "Moves", game.moves) @@ -426,7 +435,9 @@ function update() { } if (game.status === 0) { - if (user_id) + if (game.is_ready) + window.game_enter.textContent = "Waiting to start." + else if (user_id) window.game_enter.textContent = "Waiting for players to join." else window.game_enter.innerHTML = `Login or sign up to join.` -- cgit v1.2.3