Commit c106fedf authored by Matheus Miranda's avatar Matheus Miranda
Browse files

Fix condition for last available unit

parent 1e09d01c
......@@ -214,6 +214,9 @@ class Course(models.Model):
return lessons
def last_public_lesson(self):
return published
def first_lesson(self):
if self.lessons.exists():
return self.lessons.all()[0]
......@@ -506,6 +509,8 @@ class CourseStudent(models.Model):
if next_units:
next_unit = next_units.first()
elif cur_lesson == self.course.public_lessons[-1]:
next_unit = last_unit_done.unit
if next_unit:
return next_unit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment