summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorKing2019-03-06 11:40:41 +0530
committerGitHub2019-03-06 11:40:41 +0530
commitc05e98fdd7226d2e400fce5c8bef2998bfb5e425 (patch)
tree876f0d370faf3f726e4965ff962e13d86de4f937 /yaksh/models.py
parent54d7f6484768cd38c6f15c06b82f7c286bdb45f3 (diff)
parentc6475d2dc6c08fbaac3a0803f2b88c1aed539ff1 (diff)
downloadonline_test-c05e98fdd7226d2e400fce5c8bef2998bfb5e425.tar.gz
online_test-c05e98fdd7226d2e400fce5c8bef2998bfb5e425.tar.bz2
online_test-c05e98fdd7226d2e400fce5c8bef2998bfb5e425.zip
Merge pull request #563 from ankitjavalkar/quiz-inprogress-bug-fix
Allow student to open a quiz if status is inprogress
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 7e0364a..1d6bb89 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -1604,7 +1604,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
+ 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):