From 49d5ca4292b63a802e1321a972387ca755e95c5d Mon Sep 17 00:00:00 2001 From: Anand Chitipothu Date: Sat, 8 May 2021 13:40:46 +0530 Subject: [PATCH] fix: added index to lesson doctype to fix the display order --- community/lms/doctype/chapter/chapter.py | 3 ++- community/lms/doctype/lesson/lesson.json | 11 +++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/community/lms/doctype/chapter/chapter.py b/community/lms/doctype/chapter/chapter.py index d8e13097..fb201a4c 100644 --- a/community/lms/doctype/chapter/chapter.py +++ b/community/lms/doctype/chapter/chapter.py @@ -10,5 +10,6 @@ class Chapter(Document): def get_lessons(self): rows = frappe.db.get_all("Lesson", filters={"chapter": self.name}, - fields='*') + fields='*', + order_by="index_") return [frappe.get_doc(dict(row, doctype='Lesson')) for row in rows] diff --git a/community/lms/doctype/lesson/lesson.json b/community/lms/doctype/lesson/lesson.json index 79203a93..9c202d2f 100644 --- a/community/lms/doctype/lesson/lesson.json +++ b/community/lms/doctype/lesson/lesson.json @@ -8,7 +8,8 @@ "field_order": [ "chapter", "lesson_type", - "title" + "title", + "index_" ], "fields": [ { @@ -31,11 +32,17 @@ "fieldtype": "Data", "in_list_view": 1, "label": "Title" + }, + { + "default": "1", + "fieldname": "index_", + "fieldtype": "Int", + "label": "Index" } ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-05-03 06:51:43.588969", + "modified": "2021-05-08 13:25:13.965162", "modified_by": "Administrator", "module": "LMS", "name": "Lesson",