refactor: derive is_scorm_package from Lesson instead of Chapter
This commit is contained in:
+5
-6
@@ -1222,24 +1222,23 @@ def get_course_outline(course, progress=False):
|
|||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_lesson(course, chapter, lesson):
|
def get_lesson(course, chapter, lesson):
|
||||||
chapter_name = frappe.db.get_value("Chapter Reference", {"parent": course, "idx": chapter}, "chapter")
|
chapter_name = frappe.db.get_value("Chapter Reference", {"parent": course, "idx": chapter}, "chapter")
|
||||||
is_scorm_chapter = frappe.db.get_value("Course Chapter", chapter_name, "is_scorm_package")
|
|
||||||
lesson_name = frappe.db.get_value("Lesson Reference", {"parent": chapter_name, "idx": lesson}, "lesson")
|
lesson_name = frappe.db.get_value("Lesson Reference", {"parent": chapter_name, "idx": lesson}, "lesson")
|
||||||
lesson_details = frappe.db.get_value(
|
lesson_details = frappe.db.get_value(
|
||||||
"Course Lesson",
|
"Course Lesson",
|
||||||
lesson_name,
|
lesson_name,
|
||||||
["include_in_preview", "title"],
|
["include_in_preview", "title", "is_scorm_package"],
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
if is_scorm_chapter:
|
if not lesson_details:
|
||||||
|
return {}
|
||||||
|
|
||||||
|
if lesson_details.is_scorm_package:
|
||||||
return {
|
return {
|
||||||
"is_scorm_package": True,
|
"is_scorm_package": True,
|
||||||
"chapter_name": chapter_name,
|
"chapter_name": chapter_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
if not lesson_details:
|
|
||||||
return {}
|
|
||||||
|
|
||||||
membership = get_membership(course)
|
membership = get_membership(course)
|
||||||
course_info = frappe.db.get_value(
|
course_info = frappe.db.get_value(
|
||||||
"LMS Course",
|
"LMS Course",
|
||||||
|
|||||||
Reference in New Issue
Block a user