From 11589e7c4bb1b69473588d133db8b6d1d37b8fee Mon Sep 17 00:00:00 2001 From: Benjamin Auder Date: Mon, 16 Mar 2020 20:27:55 +0100 Subject: [PATCH] Fix SQL query to get completed games --- server/models/Game.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/server/models/Game.js b/server/models/Game.js index 080cab3c..641c0dce 100644 --- a/server/models/Game.js +++ b/server/models/Game.js @@ -232,11 +232,18 @@ const GameModel = "JOIN Variants v " + " ON g.vid = v.id " + "WHERE " + - " score <> '*' AND " + - " created < " + cursor + " AND " + + " score <> '*' AND" + + " created < " + cursor + " AND" + " (" + - " (" + uid + " = white AND NOT deletedByWhite) OR " + - " (" + uid + " = black AND NOT deletedByBlack)" + + " (" + + " white = " + uid + " AND" + + " (deletedByWhite IS NULL OR NOT deletedByWhite)" + + " )" + + " OR " + + " (" + + " black = " + uid + " AND" + + " (deletedByBlack IS NULL OR NOT deletedByBlack)" + + " )" + " ) "; query += "ORDER BY created DESC " + -- 2.44.0