fix: condition to check course and chapter
This commit is contained in:
@@ -12,4 +12,4 @@ community.patches.v0_0.course_instructor_update
|
||||
execute:frappe.delete_doc("DocType", "Discussion Message")
|
||||
execute:frappe.delete_doc("DocType", "Discussion Thread")
|
||||
community.patches.v0_0.rename_chapters_and_lessons_doctype
|
||||
community.patches.v0_0.rename_chapter_and_lesson_doctype #25-09-2021
|
||||
community.patches.v0_0.rename_chapter_and_lesson_doctype #26-09-2021
|
||||
|
||||
@@ -16,15 +16,17 @@ def execute():
|
||||
def move_chapters():
|
||||
docs = frappe.get_all("Chapter", fields=["*"])
|
||||
for doc in docs:
|
||||
keys = doc
|
||||
keys.update({"doctype": "Course Chapter"})
|
||||
del keys["name"]
|
||||
frappe.get_doc(keys).save()
|
||||
if frappe.db.exists("LMS Course", doc.course):
|
||||
keys = doc
|
||||
keys.update({"doctype": "Course Chapter"})
|
||||
del keys["name"]
|
||||
frappe.get_doc(keys).save()
|
||||
|
||||
def move_lessons():
|
||||
docs = frappe.get_all("Lesson", fields=["*"])
|
||||
for doc in docs:
|
||||
keys = doc
|
||||
keys.update({"doctype": "Course Lesson"})
|
||||
del keys["name"]
|
||||
frappe.get_doc(keys).save()
|
||||
if frappe.db.exists("Chapter", doc.chapter):
|
||||
keys = doc
|
||||
keys.update({"doctype": "Course Lesson"})
|
||||
del keys["name"]
|
||||
frappe.get_doc(keys).save()
|
||||
|
||||
Reference in New Issue
Block a user