From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 4 Mar 2020 22:54:55 +0000 (+0100)
Subject: Add debug trace to understand why corr move 1 isn't recorded
X-Git-Url: https://git.auder.net/variants/Apocalypse/scripts/current/pieces/doc/%24%7BgetWhatsApp%28link%29%7D?a=commitdiff_plain;h=3b64b66722edfed26978c2894e5357d066f33943;p=vchess.git

Add debug trace to understand why corr move 1 isn't recorded
---

diff --git a/server/models/Game.js b/server/models/Game.js
index cfaddfef..92c01301 100644
--- a/server/models/Game.js
+++ b/server/models/Game.js
@@ -253,13 +253,13 @@ const GameModel =
         db.get(query, (err,ret) => {
           const m = obj.move;
 
+return cb({errmsg: ret.maxIdx + " " + m.idx + " " + (!ret.maxIdx || ret.maxIdx + 1 == m.idx) + " " + query});
 
 
           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);
           }