From ef22478a11d518982f38a6a0d4d84f6f8ba5e492 Mon Sep 17 00:00:00 2001 From: adityacp Date: Sun, 14 Jan 2018 16:20:58 +0530 Subject: Change in models.py, course.js and course_detail.html - Merge future imports in models into one - Add table sorter in course.js and course_detail.html --- yaksh/models.py | 7 +++--- yaksh/static/yaksh/js/course.js | 3 +++ yaksh/templates/yaksh/course_detail.html | 37 ++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/yaksh/models.py b/yaksh/models.py index 3b1e3ba..f0d1b2e 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1,5 +1,4 @@ -from __future__ import unicode_literals -from __future__ import division +from __future__ import unicode_literals, division from datetime import datetime, timedelta import json import random @@ -489,7 +488,7 @@ class LearningModule(models.Model): def get_module_complete_percent(self, course, user): units = self.get_learning_units() if not units: - percent = 0 + percent = 0.0 else: status_list = [unit.get_completion_status(user, course) for unit in units] @@ -700,7 +699,7 @@ class Course(models.Model): def percent_completed(self, user): modules = self.get_learning_modules() if not modules: - percent = 0 + percent = 0.0 else: status_list = [module.get_module_complete_percent(self, user) for module in modules] diff --git a/yaksh/static/yaksh/js/course.js b/yaksh/static/yaksh/js/course.js index 1ca908b..1c64a3e 100644 --- a/yaksh/static/yaksh/js/course.js +++ b/yaksh/static/yaksh/js/course.js @@ -133,6 +133,9 @@ $("#export").click(function (event) { exportTableToCSV.apply(this, [$('#course_table'), outputFile]); }); +// Table sorter for course details +$("table").tablesorter({}); + }); function view_status(unit){ diff --git a/yaksh/templates/yaksh/course_detail.html b/yaksh/templates/yaksh/course_detail.html index cd9d149..a5d10a7 100644 --- a/yaksh/templates/yaksh/course_detail.html +++ b/yaksh/templates/yaksh/course_detail.html @@ -10,6 +10,7 @@ + {% endblock %} {% block css %} @@ -20,7 +21,7 @@