summaryrefslogtreecommitdiff
path: root/server.js
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2021-07-10 00:53:29 +0200
committerTor Andersson <tor@ccxvii.net>2021-07-10 00:53:29 +0200
commitd0175eec70debe3fbabf1869f420e92c7313c2ad (patch)
tree73a21d674f57a205a23b63a301b2aed79ac097a3 /server.js
parent9f8cec0889c79d9ead6d077077634754761a8dc1 (diff)
downloadserver-d0175eec70debe3fbabf1869f420e92c7313c2ad.tar.gz
Fix yellow "your turn" coloring in join and profile pages.
Diffstat (limited to 'server.js')
-rw-r--r--server.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/server.js b/server.js
index 65aacae..56e9ce7 100644
--- a/server.js
+++ b/server.js
@@ -554,7 +554,7 @@ for (let title_id of db.prepare("SELECT * FROM titles").pluck().all()) {
const QUERY_GAME = db.prepare("SELECT * FROM game_view WHERE game_id = ?");
const QUERY_LIST_GAMES_OF_TITLE = db.prepare(`
- SELECT *, ( active_id = ? OR active_role = 'Both' OR active_role = 'All' ) AS is_your_turn FROM game_view
+ SELECT * FROM game_view
WHERE title_id = ? AND private = 0
ORDER BY status ASC, mtime DESC
`);
@@ -644,7 +644,7 @@ app.get('/info/:title_id', function (req, res) {
return res.redirect('/');
}
if (req.isAuthenticated()) {
- let games = QUERY_LIST_GAMES_OF_TITLE.all(req.user.user_id, title_id);
+ let games = QUERY_LIST_GAMES_OF_TITLE.all(title_id);
humanize(games);
let open_games = games.filter(game => game.status === 0);
let active_games = games.filter(game => game.status === 1);
@@ -1375,11 +1375,11 @@ app.get('/users', function (req, res) {
res.render('users.ejs', { user: req.user, message: req.flash('message'), userList: rows });
});
-const QUERY_LIST_GAMES = db.prepare("SELECT *, ( active_id = ? OR active_role = 'Both' OR active_role = 'All' ) AS is_your_turn FROM game_view WHERE private = 0 AND status < 2");
+const QUERY_LIST_GAMES = db.prepare("SELECT * FROM game_view WHERE private = 0 AND status < 2");
app.get('/games', must_be_logged_in, function (req, res) {
LOG(req, "GET /join");
- let games = QUERY_LIST_GAMES.all(req.user.user_id);
+ let games = QUERY_LIST_GAMES.all();
humanize(games);
let open_games = games.filter(game => game.status === 0);
let active_games = games.filter(game => game.status === 1);