diff options
author | adityacp | 2017-10-07 20:30:11 +0530 |
---|---|---|
committer | adityacp | 2017-10-07 20:30:11 +0530 |
commit | bb5d9e665f5d523a85f31a50bc9c4c73033e4f0f (patch) | |
tree | aedd1815c3ea823c435a0815b06abc81eaa727d3 | |
parent | f7a1535c60663cd99da62b59de939628502e953d (diff) | |
download | online_test-bb5d9e665f5d523a85f31a50bc9c4c73033e4f0f.tar.gz online_test-bb5d9e665f5d523a85f31a50bc9c4c73033e4f0f.tar.bz2 online_test-bb5d9e665f5d523a85f31a50bc9c4c73033e4f0f.zip |
Fix quiz failure on trying to revisit after attempting all questions
-rw-r--r-- | yaksh/models.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index eb14e06..787daa6 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1187,9 +1187,9 @@ class AnswerPaper(models.Model): def current_question(self): """Returns the current active question to display.""" - questions = self.questions_unanswered.all() - if questions.exists(): - cur_question = self.get_current_question(questions) + unanswered_questions = self.questions_unanswered.all() + if unanswered_questions.exists(): + cur_question = self.get_current_question(unanswered_questions) else: cur_question = self.get_current_question(self.questions.all()) return cur_question @@ -1197,7 +1197,7 @@ class AnswerPaper(models.Model): def get_current_question(self, questions): if self.questions_order: question_id = int(self.questions_order.split(',')[0]) - question = self.questions_unanswered.get(id=question_id) + question = questions.get(id=question_id) else: question = questions.first() return question |