Commit 135deacd by Иван Кубота

no active

parent 87d88c26
......@@ -321,16 +321,19 @@ module.exports = {
fn: async function (args) {
// sub my completed attempt
return (await asyncPool(`select * from quiz
left join quiz_position on quiz_position.quiz_id = quiz.id
WHERE user_position_id=(SELECT position_id from users WHERE id=?) and end_date>=CURDATE() && start_date<=CURDATE();`, [args.userID])).map(q=>{
var actives = (await asyncPool(`select q.*, p.*, a.completed from quiz as q
left join quiz_position as p on p.quiz_id = q.id
left join quiz_attempt as a on (a.user_id = ? and a.quiz_position_id = p.id)
WHERE user_position_id=(SELECT position_id from users WHERE id=?) and end_date>=CURDATE() and start_date<=CURDATE();`, [args.userID,args.userID])).map(q=>{
try{
q.tags = JSON.parse(JSON.parse(q.tags));
}catch (e) {
console.error('Can not parse tags');
}
return q;
});
}).filter(a=>a.completed !== 1);
return actives;
}
},
'/api/quiz/notCompleted/:userID': {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment