From bb5d9e665f5d523a85f31a50bc9c4c73033e4f0f Mon Sep 17 00:00:00 2001 From: adityacp Date: Sat, 7 Oct 2017 20:30:11 +0530 Subject: Fix quiz failure on trying to revisit after attempting all questions --- yaksh/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'yaksh') 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 -- cgit