summaryrefslogtreecommitdiff
path: root/yaksh/views.py
diff options
context:
space:
mode:
authorankitjavalkar2020-05-27 21:52:07 +0530
committerGitHub2020-05-27 21:52:07 +0530
commit73dc8f6820c6c86fd8e70a68456ca2e541801bde (patch)
tree8b3399aace86cddc19818dece0040420acc49da5 /yaksh/views.py
parent372a7c56adaeabee374f9fd9268f1ebf0e082265 (diff)
parentb3b450f7c575f9cf8ed9a8b12e495f4be0adc143 (diff)
downloadonline_test-73dc8f6820c6c86fd8e70a68456ca2e541801bde.tar.gz
online_test-73dc8f6820c6c86fd8e70a68456ca2e541801bde.tar.bz2
online_test-73dc8f6820c6c86fd8e70a68456ca2e541801bde.zip
Merge pull request #715 from ankitjavalkar/fix-timer-bug
Check if attempts are allowed and spare time is available before answer is checked
Diffstat (limited to 'yaksh/views.py')
-rw-r--r--yaksh/views.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/yaksh/views.py b/yaksh/views.py
index ca827ac..3adb536 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -743,6 +743,12 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None,
if request.method == 'POST':
# Add the answer submitted, regardless of it being correct or not.
+ if (paper.time_left() <= -10 or paper.status == "completed"):
+ reason = 'Your time is up!'
+ return complete(
+ request, reason, paper.attempt_number, paper.question_paper.id,
+ course_id, module_id=module_id
+ )
if current_question.type == 'mcq':
user_answer = request.POST.get('answer')
elif current_question.type == 'integer':