Commit 679e51d3 by Иван Кубота

get latest completed quiz

parent 135deacd
......@@ -348,6 +348,18 @@ module.exports = {
return await asyncPool(`select *, quiz_attempt.id as attempt_id from quiz_attempt left join quiz_position on quiz_position.id = quiz_attempt.quiz_position_id where user_id=? and completed=0;`, [args.userID]);
}
},
'/api/quiz/result/latest/:userID': {
options: {
userID: {required: false, description: 'id of user', type: Number},
},
method: 'GET',
summary: 'Get last completed attempt by user id',
fn: async function (args) {
// sub my completed attempt
return await asyncPool('SELECT * from quiz_attempt where user_id=? and completed=1 ORDER BY id desc LIMIT 1;', [args.userID]);
}
},
'/api/quiz/attempt/:attemptID': {
options: {
attemptID: {required: false, description: 'id of attempt', type: Number},
......
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