diff options
author | King | 2019-03-06 11:40:41 +0530 |
---|---|---|
committer | GitHub | 2019-03-06 11:40:41 +0530 |
commit | c05e98fdd7226d2e400fce5c8bef2998bfb5e425 (patch) | |
tree | 876f0d370faf3f726e4965ff962e13d86de4f937 /yaksh/views.py | |
parent | 54d7f6484768cd38c6f15c06b82f7c286bdb45f3 (diff) | |
parent | c6475d2dc6c08fbaac3a0803f2b88c1aed539ff1 (diff) | |
download | online_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/views.py')
-rw-r--r-- | yaksh/views.py | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 94ef19b..9199a3a 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -528,23 +528,28 @@ def start(request, questionpaper_id=None, attempt_num=None, course_id=None, # if any previous attempt last_attempt = AnswerPaper.objects.get_user_last_attempt( quest_paper, user, course_id) - if last_attempt and last_attempt.is_attempt_inprogress(): - return show_question( - request, last_attempt.current_question(), last_attempt, - course_id=course_id, module_id=module_id, - previous_question=last_attempt.current_question() - ) + + if last_attempt: + if last_attempt.is_attempt_inprogress(): + return show_question( + request, last_attempt.current_question(), last_attempt, + course_id=course_id, module_id=module_id, + previous_question=last_attempt.current_question() + ) + attempt_number = last_attempt.attempt_number + 1 + else: + attempt_number = 1 + # allowed to start if not quest_paper.can_attempt_now(user, course_id)[0]: msg = quest_paper.can_attempt_now(user, course_id)[1] if is_moderator(user): return prof_manage(request, msg=msg) - return view_module(request, module_id=module_id, course_id=course_id, - msg=msg) - if not last_attempt: - attempt_number = 1 - else: - attempt_number = last_attempt.attempt_number + 1 + return complete( + request, msg, last_attempt.attempt_number, quest_paper.id, + course_id=course_id, module_id=module_id + ) + if attempt_num is None and not quest_paper.quiz.is_exercise: context = { 'user': user, |