projects
/
vchess.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix corr challenges
[vchess.git]
/
server
/
models
/
Challenge.js
diff --git
a/server/models/Challenge.js
b/server/models/Challenge.js
index
7ccaa76
..
fabeb7a
100644
(file)
--- a/
server/models/Challenge.js
+++ b/
server/models/Challenge.js
@@
-56,14
+56,17
@@
const ChallengeModel =
});
},
});
},
- // All challenges except where target is defined and not me
+ // All challenges except where target is defined and not me,
+ // and I'm not the sender.
getByUser: function(uid, cb)
{
db.serialize(function() {
const query =
"SELECT * " +
"FROM Challenges " +
getByUser: function(uid, cb)
{
db.serialize(function() {
const query =
"SELECT * " +
"FROM Challenges " +
- "WHERE target IS NULL OR target = " + uid;
+ "WHERE target IS NULL" +
+ " OR uid = " + uid +
+ " OR target = " + uid;
db.all(query, (err,challenges) => {
return cb(err, challenges);
});
db.all(query, (err,challenges) => {
return cb(err, challenges);
});