Some adjustments, next: fix time control handling + finish corr play
[vchess.git] / server / models / Game.js
index 23a74e8..6f15137 100644 (file)
@@ -94,14 +94,14 @@ const GameModel =
                });
        },
 
-       getByUser: function(uid, cb)
+       getByUser: function(uid, excluded, cb)
        {
                db.serialize(function() {
                        // Next query is fine because a player appear at most once in a game
                        const query =
                                "SELECT gid " +
                                "FROM Players " +
-                               "WHERE uid = " + uid;
+                               "WHERE uid " + (excluded ? "<>" : "=") + " " + uid;
                        db.run(query, (err,gameIds) => {
                                if (!!err)
                                        return cb(err);