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 | |
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')
-rw-r--r-- | yaksh/live_server_tests/selenium_test.py | 2 | ||||
-rw-r--r-- | yaksh/templates/yaksh/complete.html | 2 | ||||
-rw-r--r-- | yaksh/views.py | 17 |
3 files changed, 10 insertions, 11 deletions
diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 01ccc96..7eeb22c 100644 --- a/yaksh/live_server_tests/selenium_test.py +++ b/yaksh/live_server_tests/selenium_test.py @@ -111,7 +111,7 @@ class SeleniumTest(): def close_quiz(self): quit_link_elem = WebDriverWait(self.driver, 5).until( - EC.presence_of_element_located((By.ID, "login_again")) + EC.presence_of_element_located((By.ID, "home")) ) quit_link_elem.click() diff --git a/yaksh/templates/yaksh/complete.html b/yaksh/templates/yaksh/complete.html index 7bff206..45284c4 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -32,5 +32,5 @@ <center><h2> Good bye! </h2></center> <center><h4> {{message}} </h4></center> <br><center><h4>You may now close the browser.</h4></center><br> - <center><a href="{{URL_ROOT}}/exam/" id="login_again"> Login Again </a></center> + <center><a href="{{URL_ROOT}}/exam/" id="home"> Home </a></center> {% endblock content %} 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) |