projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add debug trace to understand why corr move 1 isn't recorded
[vchess.git]
/
server
/
models
/
Game.js
diff --git
a/server/models/Game.js
b/server/models/Game.js
index
3fde91f
..
4d06e48
100644
(file)
--- a/
server/models/Game.js
+++ b/
server/models/Game.js
@@
-242,7
+242,13
@@
const GameModel =
query += modifs + " WHERE id = " + id;
db.run(query);
}
query += modifs + " WHERE id = " + id;
db.run(query);
}
- if (obj.move)
+
+
+//return cb({errmsg: JSON.stringify(obj.move)});
+
+
+ // NOTE: move, chat and delchat are mutually exclusive
+ if (!!obj.move)
{
// Security: only update moves if index is right
query =
{
// Security: only update moves if index is right
query =
@@
-251,6
+257,10
@@
const GameModel =
"WHERE gid = " + id;
db.get(query, (err,ret) => {
const m = obj.move;
"WHERE gid = " + id;
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 " +
if (!ret.maxIdx || ret.maxIdx + 1 == m.idx) {
query =
"INSERT INTO Moves (gid, squares, played, idx) VALUES " +
@@
-275,7
+285,7
@@
const GameModel =
"DELETE " +
"FROM Chats " +
"WHERE gid = " + id;
"DELETE " +
"FROM Chats " +
"WHERE gid = " + id;
- db.run(query
, cb
);
+ db.run(query);
}
});
},
}
});
},