- "WHERE id = " + id;
- db.get(query, (err,challenge) => {
- return cb(err, challenge);
- });
- });
- },
-
- // all challenges except where target is defined and not me
- getByUser: function(uid, cb)
- {
- db.serialize(function() {
- const query =
- "SELECT * " +
- "FROM Challenges " +
- "WHERE target IS NULL OR target = " + uid;
- db.all(query, (err,challenges) => {
- return cb(err, challenges);
+ "WHERE target IS NULL" +
+ " OR uid = " + uid +
+ " OR target = " + uid;
+ db.all(query, (err, challenges) => {
+ cb(err, challenges);