summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-10-07 22:51:19 +0530
committerGitHub2017-10-07 22:51:19 +0530
commit97a277cf5b86f60525f94302d5b04de420ad7212 (patch)
treeaedd1815c3ea823c435a0815b06abc81eaa727d3 /yaksh/models.py
parent39ec0271244826b2693f01f6daaa99525404e15a (diff)
parentbb5d9e665f5d523a85f31a50bc9c4c73033e4f0f (diff)
downloadonline_test-97a277cf5b86f60525f94302d5b04de420ad7212.tar.gz
online_test-97a277cf5b86f60525f94302d5b04de420ad7212.tar.bz2
online_test-97a277cf5b86f60525f94302d5b04de420ad7212.zip
Merge pull request #348 from adityacp/fix_quit_failure
Fix quiz failure
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py8
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