Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MOOC packages by hacklab
django-courses
Commits
c106fedf
Commit
c106fedf
authored
Dec 01, 2021
by
Matheus Miranda
Browse files
Fix condition for last available unit
parent
1e09d01c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
courses/models.py
courses/models.py
+5
-0
No files found.
courses/models.py
View file @
c106fedf
...
...
@@ -214,6 +214,9 @@ class Course(models.Model):
lessons
.
append
(
lesson
)
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):
status
=
'published'
).
order_by
(
'position'
)
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment