summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authoradityacp2018-05-29 15:40:50 +0530
committeradityacp2018-05-29 15:43:38 +0530
commit5da8a3537b1ffb51145cbba0500cedda9f2b48da (patch)
tree0fa0a2f2798f5c3209f23c43b94b91a1e28e7320 /yaksh/models.py
parent458134e4d110be451ed7e7c5f001c2d204e1e892 (diff)
downloadonline_test-5da8a3537b1ffb51145cbba0500cedda9f2b48da.tar.gz
online_test-5da8a3537b1ffb51145cbba0500cedda9f2b48da.tar.bz2
online_test-5da8a3537b1ffb51145cbba0500cedda9f2b48da.zip
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
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py9
1 files changed, 5 insertions, 4 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):