From 011a65cbe75dc596a095f03f373f4f875fa80066 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Thu, 16 Feb 2017 17:58:09 +0530 Subject: Multiple minor fixes - Display a message when the question paper exists but has no questions - Avoid logout after encountering no quiz/no questions - Remove incorrect logout message in complete --- yaksh/live_server_tests/selenium_test.py | 2 +- yaksh/templates/yaksh/complete.html | 2 +- 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..738dca0 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, "go_to_home")) ) quit_link_elem.click() diff --git a/yaksh/templates/yaksh/complete.html b/yaksh/templates/yaksh/complete.html index 7bff206..81b6668 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -32,5 +32,5 @@

Good bye!

{{message}}


You may now close the browser.


-
Login Again
+
Go To Home
{% 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) -- cgit From 7f1d92397166efb0a8a53bbdc8de5f8bc6535413 Mon Sep 17 00:00:00 2001 From: ankitjavalkar Date: Fri, 17 Feb 2017 16:20:13 +0530 Subject: Modify button label in complete.html --- yaksh/live_server_tests/selenium_test.py | 2 +- yaksh/templates/yaksh/complete.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/yaksh/live_server_tests/selenium_test.py b/yaksh/live_server_tests/selenium_test.py index 738dca0..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, "go_to_home")) + 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 81b6668..45284c4 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -32,5 +32,5 @@

Good bye!

{{message}}


You may now close the browser.


-
Go To Home
+
Home
{% endblock content %} -- cgit