Fix notifications in case of new corr move
[vchess.git] / server / models / Game.js
index 9d70082..f175164 100644 (file)
@@ -166,7 +166,7 @@ const GameModel =
   {
     db.serialize(function() {
       const query =
-        "SELECT id " +
+        "SELECT uid " +
         "FROM Players " +
         "WHERE gid = " + id;
       db.all(query, (err,players) => {
@@ -275,7 +275,7 @@ const GameModel =
     const day = 86400000;
     db.serialize(function() {
       let query =
-        "SELECT id,created " +
+        "SELECT id, created " +
         "FROM Games ";
       db.all(query, (err,games) => {
         games.forEach(g => {
@@ -289,7 +289,7 @@ const GameModel =
             if ((mstats.nbMoves == 0 && tsNow - g.created > 91*day) ||
               (mstats.nbMoves == 1 && tsNow - mstats.lastMaj > 91*day))
             {
-              return GameModel.remove(g.id);
+              GameModel.remove(g.id);
             }
           });
         });