summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-01-13 13:23:32 +0100
committerTor Andersson <tor@ccxvii.net>2024-01-28 13:50:27 +0100
commitcccb8136eb28268ab42770160cbffc263a896dfc (patch)
treef0672f46429ae69beb36af21768acfa4f13cf885 /server.js
parent143d3920f68a01ad062865a65438923e68322a1b (diff)
downloadserver-cccb8136eb28268ab42770160cbffc263a896dfc.tar.gz
Show multiplayer results by player name in game boxes.
Diffstat (limited to 'server.js')
-rw-r--r--server.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/server.js b/server.js
index 132c1cd..3dc7e52 100644
--- a/server.js
+++ b/server.js
@@ -1466,6 +1466,15 @@ function annotate_game_info(game, user_id, unread) {
game.result = `<a href="/user/${p.name}">${p.name}</a> (${game.result})`
}
+ if (game.result && game.result.includes(",")) {
+ game.result = game.result.split(", ").map(role => {
+ for (let p of game.players)
+ if (p.role === role)
+ return `<a href="/user/${p.name}">${p.name}</a>`
+ return role
+ }).join(", ")
+ }
+
if (game.status === STATUS_OPEN && game.is_ready && game.owner_id === user_id)
game.your_turn = true