summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index 7a4d8d1..c4e5a50 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1600,7 +1600,9 @@ class QuestionPaper(models.Model):
attempts = AnswerPaper.objects.get_total_attempt(questionpaper=self,
user=user,
course_id=course_id)
- return attempts < self.quiz.attempts_allowed or self.quiz.attempts_allowed == -1
+ attempts_allowed = attempts < self.quiz.attempts_allowed
+ infinite_attempts = self.quiz.attempts_allowed == -1
+ return attempts_allowed or infinite_attempts
def can_attempt_now(self, user, course_id):
if self._is_attempt_allowed(user, course_id):