fix: ui, preview, progress, batches
This commit is contained in:
@@ -3,6 +3,8 @@ import frappe
|
||||
from . import utils
|
||||
from frappe.utils import cstr
|
||||
|
||||
from community.www import batch
|
||||
|
||||
def get_context(context):
|
||||
utils.get_common_context(context)
|
||||
|
||||
@@ -11,11 +13,12 @@ def get_context(context):
|
||||
lesson_number = f"{chapter_index}.{lesson_index}"
|
||||
|
||||
course_name = context.course.name
|
||||
print(chapter_index, lesson_index)
|
||||
if not chapter_index or not lesson_index:
|
||||
index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1"
|
||||
print(index_)
|
||||
frappe.local.flags.redirect_location = context.batch.get_learn_url(index_)
|
||||
if context.batch:
|
||||
index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1"
|
||||
else:
|
||||
index_ = "1.1"
|
||||
frappe.local.flags.redirect_location = context.course.get_learn_url(index_)
|
||||
raise frappe.Redirect
|
||||
|
||||
context.lesson = context.course.get_lesson(chapter_index, lesson_index)
|
||||
@@ -27,8 +30,8 @@ def get_context(context):
|
||||
next_ = outline.get_next(lesson_number)
|
||||
context.prev_chap = get_chapter_title(course_name, prev_)
|
||||
context.next_chap = get_chapter_title(course_name, next_)
|
||||
context.next_url = context.batch.get_learn_url(next_)
|
||||
context.prev_url = context.batch.get_learn_url(prev_)
|
||||
context.next_url = context.course.get_learn_url(next_)
|
||||
context.prev_url = context.course.get_learn_url(prev_)
|
||||
|
||||
context.page_extensions = get_page_extensions()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user