summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server.js3
-rw-r--r--views/head.pug2
2 files changed, 3 insertions, 2 deletions
diff --git a/server.js b/server.js
index 342e9a1..710879f 100644
--- a/server.js
+++ b/server.js
@@ -1036,7 +1036,7 @@ function annotate_game(game, user_id) {
if (p.user_id === user_id) {
your_role = p.role
your_count++
- if (p_is_active || (p_is_owner && game.is_ready))
+ if ((p_is_active || p_is_owner) && game.is_ready)
game.your_turn = true
}
@@ -1093,6 +1093,7 @@ function sort_your_turn(a, b) {
app.get('/games/active', must_be_logged_in, function (req, res) {
let games = QUERY_LIST_ACTIVE_GAMES_OF_USER.all({ user_id: req.user.user_id })
annotate_games(games, req.user.user_id)
+ games.sort(sort_your_turn)
res.render('games_active.pug', { user: req.user, who: req.user, games: games })
})
diff --git a/views/head.pug b/views/head.pug
index 005a4b2..08f2660 100644
--- a/views/head.pug
+++ b/views/head.pug
@@ -61,7 +61,7 @@ mixin gamelist(list,hide_title=0)
case item.status
when 0
- if item.is_yours && item.is_ready
+ if item.is_ready && item.your_turn
a(class="command" href=`/join/${item.game_id}`) Start
else
a(class="command" href=`/join/${item.game_id}`) Join