From 5da8a3537b1ffb51145cbba0500cedda9f2b48da Mon Sep 17 00:00:00 2001 From: adityacp Date: Tue, 29 May 2018 15:40:50 +0530 Subject: Change in models, templates, js - Remove else condition in get_current_unit model method - Reduce ajax timeout in course.js - Create a new model method to set current unit - Change views test --- yaksh/models.py | 9 +++++---- yaksh/static/yaksh/js/course.js | 2 +- yaksh/templates/yaksh/complete.html | 7 +++---- yaksh/templates/yaksh/course_detail.html | 4 ++-- yaksh/test_views.py | 2 +- yaksh/views.py | 3 +-- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/yaksh/models.py b/yaksh/models.py index 4c9ab98..36e859c 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -788,10 +788,7 @@ class Course(models.Model): def get_current_unit(self, user): course_status = CourseStatus.objects.filter(course=self, user=user) if course_status.exists(): - unit = course_status.first().current_unit - else: - unit = "NA" - return unit + return course_status.first().current_unit def days_before_start(self): """ Get the days remaining for the start of the course """ @@ -862,6 +859,10 @@ class CourseStatus(models.Model): break return complete + def set_current_unit(self, unit): + self.current_unit = unit + self.save() + ############################################################################### class ConcurrentUser(models.Model): diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js index 36e565a..bd197a8 100644 --- a/yaksh/static/yaksh/js/course.js +++ b/yaksh/static/yaksh/js/course.js @@ -81,7 +81,7 @@ $('.user_data').click(function() { "/exam/manage/get_user_status/" + course_id + "/" + student_id; $.ajax({ url: get_url, - timeout: 15000, + timeout: 8000, type: "GET", dataType: "json", contentType: 'application/json; charset=utf-8', diff --git a/yaksh/templates/yaksh/complete.html b/yaksh/templates/yaksh/complete.html index 567d01f..a3627d0 100644 --- a/yaksh/templates/yaksh/complete.html +++ b/yaksh/templates/yaksh/complete.html @@ -3,11 +3,10 @@ {% block pagetitle %}YAKSH{% endblock %} {% block content %} -{% if module_id and not user == "moderator" %} +{% if module_id and not paper.question_paper.quiz.is_trial %}
- Note:- Please Click on the Next button to submit the quiz. Please do not close the browser - without clicking next. + Note:- Please Click on the Next button to submit the quiz. Please do not close the browser without clicking Next.
{% endif %} @@ -41,7 +40,7 @@ width="80" alt="YAKSH">{% endblock %}

{{message}}


- {% if module_id and not user == "moderator" %} + {% if module_id and not paper.question_paper.quiz.is_trial %} {% if first_unit %}