Fix GameModel.cleanDb()
[vchess.git] / server / models / Game.js
index ee381d4..516c4bc 100644 (file)
@@ -313,7 +313,7 @@ const GameModel =
       ) && (
         !obj.score || !!(obj.score.match(/^[012?*\/-]+$/))
       ) && (
-        !obj.chatRead || !(['w','b'].includes(obj.chatRead))
+        !obj.chatRead || ['w','b'].includes(obj.chatRead)
       ) && (
         !obj.scoreMsg || !!(obj.scoreMsg.match(/^[a-zA-Z ]+$/))
       ) && (
@@ -483,6 +483,7 @@ const GameModel =
               )
               ||
               (
+                !!movesGroups[g.id] &&
                 movesGroups[g.id].nbMoves == 1 &&
                 tsNow - movesGroups[g.id].lastMaj > 14*day
               )