Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # TODO: complete the decoration [x]
- @quizzes.route("/quiz/<int:id>", methods=['GET', 'DELETE'])
- def single_quiz(id):
- global _LOADED_QUIZZES
- result = ""
- # TODO: check if the quiz is an existing one [x]
- exists_quiz(id)
- if 'GET' == request.method:
- # TODO: retrieve a quiz <id> [x]
- result = Quiz.getQuestion(id)
- elif 'DELETE' == request.method:
- # TODO: delete a quiz and get back number of answered questions [x][x]
- # and total number of questions [x]
- _LOADED_QUIZZES.remove(id)
- result = jsonify({
- "answered_questions": quiz.currentQuestion,
- "total_questions": quiz.questions
- })
- return result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement