summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-11-17 23:13:44 +0100
committerTor Andersson <tor@ccxvii.net>2024-11-18 12:51:27 +0100
commit8019fe4e78a2ce4b03f3b2d2d11458f59a0224ad (patch)
tree78bc9de5c23d15482ec2e0b3839a3e4016efb461
parent0316f4263bf43ef45a3b5f6a543a8f1e0347fb25 (diff)
downloadserver-8019fe4e78a2ce4b03f3b2d2d11458f59a0224ad.tar.gz
handle deleted players in tournament pool display
-rw-r--r--server.js6
-rw-r--r--views/tm_pool.pug9
2 files changed, 9 insertions, 6 deletions
diff --git a/server.js b/server.js
index 1443611..175a517 100644
--- a/server.js
+++ b/server.js
@@ -2798,7 +2798,7 @@ const TM_SELECT_GAMES = SQL(`
tm_rounds.*,
games.status,
games.moves,
- json_group_object(role, name) as role_names,
+ json_group_object(role, coalesce(name, 'null')) as role_names,
json_group_object(role, score) as role_scores
from
tm_rounds
@@ -2819,8 +2819,8 @@ const TM_SELECT_PLAYERS_2P = SQL(`
select
pool_id,
u1.user_id as user_id,
- u1.name as name,
- u2.name as opponent,
+ coalesce(u1.name, 'null') as name,
+ coalesce(u2.name, 'null') as opponent,
json_group_array(json_array(game_id, p1.score)) as result
from
tm_rounds
diff --git a/views/tm_pool.pug b/views/tm_pool.pug
index 73a52e4..1690535 100644
--- a/views/tm_pool.pug
+++ b/views/tm_pool.pug
@@ -70,7 +70,7 @@ html
tr
td= rx+1
td
- if row.name
+ if row.name && row.name !== "null"
<a class="black" href="/user/#{row.name}">#{row.name}</a>
else
| null
@@ -109,7 +109,7 @@ html
tr
td= rx+1
td
- if row.name
+ if row.name && row.name !== "null"
<a class="black" href="/user/#{row.name}">#{row.name}</a>
else
| null
@@ -143,7 +143,10 @@ html
each role in roles
- var p = role_names[role]
td
- a.black(href="/user/"+p)= p
+ if p && p !== "null"
+ a.black(href="/user/"+p)= p
+ else
+ | null
if game.status > 1
td.w.r