You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

17 lines
532 B

from courses.api import CourseProgressApi
def add_next_lesson(progress):
sorted_token_list = CourseProgressApi.get_topic_lesson(progress.course_token)
is_next = False
new_lesson = None
for lesson_list in sorted_token_list:
for lesson_token in lesson_list:
if is_next:
new_lesson = lesson_token
is_next = lesson_token == progress.active_lesson
progress.active_lesson = new_lesson
progress.save()
return "access update course %s" % progress.course_token