Add debug trace to understand why corr move 1 isn't recorded
[vchess.git] / server / models / Game.js
index d72f51a..cfaddfe 100644 (file)
@@ -252,10 +252,14 @@ const GameModel =
           "WHERE gid = " + id;
         db.get(query, (err,ret) => {
           const m = obj.move;
+
+
+
           if (!ret.maxIdx || ret.maxIdx + 1 == m.idx) {
             query =
               "INSERT INTO Moves (gid, squares, played, idx) VALUES " +
               "(" + id + ",?," + m.played + "," + m.idx + ")";
+return cb({errmsg: (!ret.maxIdx || ret.maxIdx + 1 == m.idx) + " " + query});
             db.run(query, JSON.stringify(m.squares));
             cb(null);
           }