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 Message")
|
||||||
execute:frappe.delete_doc("DocType", "Discussion Thread")
|
execute:frappe.delete_doc("DocType", "Discussion Thread")
|
||||||
community.patches.v0_0.rename_chapters_and_lessons_doctype
|
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():
|
def move_chapters():
|
||||||
docs = frappe.get_all("Chapter", fields=["*"])
|
docs = frappe.get_all("Chapter", fields=["*"])
|
||||||
for doc in docs:
|
for doc in docs:
|
||||||
keys = doc
|
if frappe.db.exists("LMS Course", doc.course):
|
||||||
keys.update({"doctype": "Course Chapter"})
|
keys = doc
|
||||||
del keys["name"]
|
keys.update({"doctype": "Course Chapter"})
|
||||||
frappe.get_doc(keys).save()
|
del keys["name"]
|
||||||
|
frappe.get_doc(keys).save()
|
||||||
|
|
||||||
def move_lessons():
|
def move_lessons():
|
||||||
docs = frappe.get_all("Lesson", fields=["*"])
|
docs = frappe.get_all("Lesson", fields=["*"])
|
||||||
for doc in docs:
|
for doc in docs:
|
||||||
keys = doc
|
if frappe.db.exists("Chapter", doc.chapter):
|
||||||
keys.update({"doctype": "Course Lesson"})
|
keys = doc
|
||||||
del keys["name"]
|
keys.update({"doctype": "Course Lesson"})
|
||||||
frappe.get_doc(keys).save()
|
del keys["name"]
|
||||||
|
frappe.get_doc(keys).save()
|
||||||
|
|||||||
Reference in New Issue
Block a user