projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add unambiguous section in the PGN + some fixes + code formatting and fix typos
[vchess.git]
/
server
/
models
/
Problem.js
diff --git
a/server/models/Problem.js
b/server/models/Problem.js
index
bcbefc5
..
2d29520
100644
(file)
--- a/
server/models/Problem.js
+++ b/
server/models/Problem.js
@@
-33,12
+33,16
@@
const ProblemModel = {
});
},
});
},
- getNext: function(cursor, cb) {
+ getNext: function(uid, onlyMine, cursor, cb) {
+ let condition = "";
+ if (onlyMine) condition = "AND uid = " + uid + " ";
+ else if (!!uid) condition = "AND uid <> " + uid + " ";
db.serialize(function() {
const query =
"SELECT * " +
"FROM Problems " +
"WHERE added < " + cursor + " " +
db.serialize(function() {
const query =
"SELECT * " +
"FROM Problems " +
"WHERE added < " + cursor + " " +
+ condition +
"ORDER BY added DESC " +
"LIMIT 20"; //TODO: 20 is arbitrary
db.all(query, (err, problems) => {
"ORDER BY added DESC " +
"LIMIT 20"; //TODO: 20 is arbitrary
db.all(query, (err, problems) => {