summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
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):