fix: added Patch to update wrong indexes for SCORM Lesson References
This commit is contained in:
@@ -110,4 +110,5 @@ lms.patches.v2_0.link_zoom_account_to_batch
|
||||
lms.patches.v2_0.sidebar_for_certified_members
|
||||
lms.patches.v2_0.move_batch_instructors_to_evaluators
|
||||
lms.patches.v2_0.enable_programming_exercises_in_sidebar
|
||||
lms.patches.v2_0.count_in_program
|
||||
lms.patches.v2_0.count_in_program
|
||||
lms.patches.v2_0.fix_scorm_lesson_reference_idx
|
||||
|
||||
13
lms/patches/v2_0/fix_scorm_lesson_reference_idx.py
Normal file
13
lms/patches/v2_0/fix_scorm_lesson_reference_idx.py
Normal file
@@ -0,0 +1,13 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
scorm_lessons = frappe.get_all("Course Lesson", filters={"is_scorm_package": 1}, pluck="name")
|
||||
table = frappe.qb.DocType("Lesson Reference")
|
||||
|
||||
q = frappe.qb.from_(table).select(table.name).where(table.lesson.isin(scorm_lessons) & table.idx == 0)
|
||||
wrong_idx_lesson_references = q.run(pluck=True)
|
||||
|
||||
for lesson_reference in wrong_idx_lesson_references:
|
||||
# For SCORM, there is only 1 lesson per chapter, so directly setting 1 is fine
|
||||
frappe.db.set_value("Lesson Reference", lesson_reference, "idx", 1)
|
||||
Reference in New Issue
Block a user