From 3b64b66722edfed26978c2894e5357d066f33943 Mon Sep 17 00:00:00 2001
From: Benjamin Auder <benjamin.auder@somewhere>
Date: Wed, 4 Mar 2020 23:54:55 +0100
Subject: [PATCH] Add debug trace to understand why corr move 1 isn't recorded

---
 server/models/Game.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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);
           }
-- 
2.44.0