diff options
author | Prabhu Ramachandran | 2017-02-17 18:45:30 +0530 |
---|---|---|
committer | GitHub | 2017-02-17 18:45:30 +0530 |
commit | ee83b9693075771dcba885bc380e20dfdd8289a1 (patch) | |
tree | 0136e94586900f005bdf14dc1190dc56aff6f698 /yaksh/views.py | |
parent | 6c5ffb79e9c8f1578768317ae334d3a16bcfd5c9 (diff) | |
parent | 7f1d92397166efb0a8a53bbdc8de5f8bc6535413 (diff) | |
download | online_test-ee83b9693075771dcba885bc380e20dfdd8289a1.tar.gz online_test-ee83b9693075771dcba885bc380e20dfdd8289a1.tar.bz2 online_test-ee83b9693075771dcba885bc380e20dfdd8289a1.zip |
Merge pull request #226 from ankitjavalkar/fix-no-qpaper-error
Multiple minor fixes
Diffstat (limited to 'yaksh/views.py')
-rw-r--r-- | yaksh/views.py | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/yaksh/views.py b/yaksh/views.py index 605d3f2..ae29508 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -348,7 +348,11 @@ def start(request, questionpaper_id=None, attempt_num=None): quest_paper = QuestionPaper.objects.get(id=questionpaper_id) except QuestionPaper.DoesNotExist: msg = 'Quiz not found, please contact your '\ - 'instructor/administrator. Please login again thereafter.' + 'instructor/administrator.' + return complete(request, msg, attempt_num, questionpaper_id=None) + if not quest_paper.fixed_questions.all() and not quest_paper.random_questions.all(): + msg = 'Quiz does not have Questions, please contact your '\ + 'instructor/administrator.' return complete(request, msg, attempt_num, questionpaper_id=None) if not quest_paper.quiz.course.is_enrolled(user): raise Http404('You are not allowed to view this page!') @@ -527,8 +531,8 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None): """Show a page to inform user that the quiz has been compeleted.""" user = request.user if questionpaper_id is None: - logout(request) - message = reason or "You are successfully logged out." + message = reason or "An Unexpected Error occurred. Please contact your '\ + 'instructor/administrator.'" context = {'message': message} return my_render_to_response('yaksh/complete.html', context) else: @@ -537,12 +541,7 @@ def complete(request, reason=None, attempt_num=None, questionpaper_id=None): attempt_number=attempt_num) paper.update_marks() paper.set_end_time(timezone.now()) - if paper.percent == 100: - message = "You answered all the questions correctly.\ - You have been logged out successfully,\ - Thank You !" - else: - message = reason or "You are successfully logged out" + message = reason or "Quiz has been submitted" context = {'message': message, 'paper': paper} return my_render_to_response('yaksh/complete.html', context) |