diff --git a/lms/lms/doctype/course_lesson/course_lesson.json b/lms/lms/doctype/course_lesson/course_lesson.json index d1e19c44..66798e15 100644 --- a/lms/lms/doctype/course_lesson/course_lesson.json +++ b/lms/lms/doctype/course_lesson/course_lesson.json @@ -66,7 +66,7 @@ }, { "fieldname": "body", - "fieldtype": "Markdown Editor", + "fieldtype": "Text Editor", "ignore_xss_filter": 1, "label": "Body", "reqd": 1 @@ -135,7 +135,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-12-28 16:01:42.191123", + "modified": "2023-04-05 12:42:16.926753", "modified_by": "Administrator", "module": "LMS", "name": "Course Lesson", diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 3a22fbdf..6f45a5a5 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -269,6 +269,7 @@ def get_progress(course, lesson): def render_html(lesson): + print(lesson.body) youtube = lesson.youtube quiz_id = lesson.quiz_id body = lesson.body diff --git a/lms/patches.txt b/lms/patches.txt index 766910ba..e9e9e212 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -49,4 +49,5 @@ lms.patches.v0_0.rename_community_to_users #06-01-2023 lms.patches.v0_0.video_embed_link lms.patches.v0_0.rename_exercise_doctype lms.patches.v0_0.add_question_type -lms.patches.v0_0.add_evaluator_to_assignment \ No newline at end of file +lms.patches.v0_0.add_evaluator_to_assignment +lms.patches.v0_0.convert_lesson_markdown_to_html #05-04-2023 \ No newline at end of file diff --git a/lms/patches/v0_0/convert_lesson_markdown_to_html.py b/lms/patches/v0_0/convert_lesson_markdown_to_html.py new file mode 100644 index 00000000..da573414 --- /dev/null +++ b/lms/patches/v0_0/convert_lesson_markdown_to_html.py @@ -0,0 +1,12 @@ +import frappe +from lms.lms.md import markdown_to_html + + +def execute(): + lessons = frappe.get_all("Course Lesson", fields=["name", "body"]) + + for lesson in lessons: + html = markdown_to_html(lesson.body) + frappe.db.set_value("Course Lesson", lesson.name, "body", html) + + frappe.reload_doc("lms", "doctype", "course_lesson")