From 64048a8a18a09ec37b7f320816ff7cff15b66aa4 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Mon, 20 Sep 2021 12:10:35 +0530 Subject: [PATCH 1/2] fix: minor issues --- community/lms/doctype/chapter/chapter.json | 6 ++++-- .../{chapters => chapter_reference}/__init__.py | 0 .../chapter_reference.json} | 2 +- .../chapter_reference.py} | 2 +- community/lms/doctype/lesson/lesson.json | 4 +++- .../doctype/{lessons => lesson_reference}/__init__.py | 0 .../lesson_reference.json} | 2 +- .../lesson_reference.py} | 2 +- community/lms/doctype/lms_course/lms_course.json | 9 +++++++-- community/lms/doctype/lms_course/lms_course.py | 4 ++-- community/lms/doctype/lms_quiz/lms_quiz.json | 4 +++- community/lms/widgets/ChapterTeaser.html | 11 ++++++++++- community/public/css/style.css | 4 ++++ community/public/node_modules | 1 + community/www/batch/learn.html | 11 +++++++++-- community/www/courses/index.py | 2 +- 16 files changed, 48 insertions(+), 16 deletions(-) rename community/lms/doctype/{chapters => chapter_reference}/__init__.py (100%) rename community/lms/doctype/{chapters/chapters.json => chapter_reference/chapter_reference.json} (95%) rename community/lms/doctype/{lessons/lessons.py => chapter_reference/chapter_reference.py} (83%) rename community/lms/doctype/{lessons => lesson_reference}/__init__.py (100%) rename community/lms/doctype/{lessons/lessons.json => lesson_reference/lesson_reference.json} (95%) rename community/lms/doctype/{chapters/chapters.py => lesson_reference/lesson_reference.py} (83%) create mode 120000 community/public/node_modules diff --git a/community/lms/doctype/chapter/chapter.json b/community/lms/doctype/chapter/chapter.json index 6a985a80..9bc525ed 100644 --- a/community/lms/doctype/chapter/chapter.json +++ b/community/lms/doctype/chapter/chapter.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_rename": 1, "autoname": "format:{####} {title}", "creation": "2021-05-03 05:49:08.383057", "doctype": "DocType", @@ -38,7 +39,7 @@ "fieldname": "lessons", "fieldtype": "Table", "label": "Lessons", - "options": "Lessons" + "options": "Lesson Reference" }, { "fieldname": "column_break_3", @@ -57,10 +58,11 @@ "link_fieldname": "chapter" } ], - "modified": "2021-08-31 10:43:45.866864", + "modified": "2021-09-20 10:58:47.241660", "modified_by": "Administrator", "module": "LMS", "name": "Chapter", + "naming_rule": "Expression", "owner": "Administrator", "permissions": [ { diff --git a/community/lms/doctype/chapters/__init__.py b/community/lms/doctype/chapter_reference/__init__.py similarity index 100% rename from community/lms/doctype/chapters/__init__.py rename to community/lms/doctype/chapter_reference/__init__.py diff --git a/community/lms/doctype/chapters/chapters.json b/community/lms/doctype/chapter_reference/chapter_reference.json similarity index 95% rename from community/lms/doctype/chapters/chapters.json rename to community/lms/doctype/chapter_reference/chapter_reference.json index 7ca73ed2..7c63fbcf 100644 --- a/community/lms/doctype/chapters/chapters.json +++ b/community/lms/doctype/chapter_reference/chapter_reference.json @@ -23,7 +23,7 @@ "modified": "2021-07-27 16:25:02.903245", "modified_by": "Administrator", "module": "LMS", - "name": "Chapters", + "name": "Chapter Reference", "owner": "Administrator", "permissions": [], "sort_field": "modified", diff --git a/community/lms/doctype/lessons/lessons.py b/community/lms/doctype/chapter_reference/chapter_reference.py similarity index 83% rename from community/lms/doctype/lessons/lessons.py rename to community/lms/doctype/chapter_reference/chapter_reference.py index 63370d40..73ca7b4f 100644 --- a/community/lms/doctype/lessons/lessons.py +++ b/community/lms/doctype/chapter_reference/chapter_reference.py @@ -4,5 +4,5 @@ # import frappe from frappe.model.document import Document -class Lessons(Document): +class ChapterReference(Document): pass diff --git a/community/lms/doctype/lesson/lesson.json b/community/lms/doctype/lesson/lesson.json index e8267c4f..84ca8120 100644 --- a/community/lms/doctype/lesson/lesson.json +++ b/community/lms/doctype/lesson/lesson.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_rename": 1, "autoname": "format:{####} {title}", "creation": "2021-05-03 06:21:12.995987", "doctype": "DocType", @@ -70,10 +71,11 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-08-31 10:44:14.168257", + "modified": "2021-09-20 10:52:29.116536", "modified_by": "Administrator", "module": "LMS", "name": "Lesson", + "naming_rule": "Expression", "owner": "Administrator", "permissions": [ { diff --git a/community/lms/doctype/lessons/__init__.py b/community/lms/doctype/lesson_reference/__init__.py similarity index 100% rename from community/lms/doctype/lessons/__init__.py rename to community/lms/doctype/lesson_reference/__init__.py diff --git a/community/lms/doctype/lessons/lessons.json b/community/lms/doctype/lesson_reference/lesson_reference.json similarity index 95% rename from community/lms/doctype/lessons/lessons.json rename to community/lms/doctype/lesson_reference/lesson_reference.json index b05f5b13..d7a0dc3a 100644 --- a/community/lms/doctype/lessons/lessons.json +++ b/community/lms/doctype/lesson_reference/lesson_reference.json @@ -23,7 +23,7 @@ "modified": "2021-08-31 10:44:42.048232", "modified_by": "Administrator", "module": "LMS", - "name": "Lessons", + "name": "Lesson Reference", "owner": "Administrator", "permissions": [], "sort_field": "modified", diff --git a/community/lms/doctype/chapters/chapters.py b/community/lms/doctype/lesson_reference/lesson_reference.py similarity index 83% rename from community/lms/doctype/chapters/chapters.py rename to community/lms/doctype/lesson_reference/lesson_reference.py index 5d07b66e..749129d3 100644 --- a/community/lms/doctype/chapters/chapters.py +++ b/community/lms/doctype/lesson_reference/lesson_reference.py @@ -4,5 +4,5 @@ # import frappe from frappe.model.document import Document -class Chapters(Document): +class LessonReference(Document): pass diff --git a/community/lms/doctype/lms_course/lms_course.json b/community/lms/doctype/lms_course/lms_course.json index d8c4d9e2..30a8475b 100644 --- a/community/lms/doctype/lms_course/lms_course.json +++ b/community/lms/doctype/lms_course/lms_course.json @@ -100,7 +100,7 @@ "fieldname": "chapters", "fieldtype": "Table", "label": "Chapters", - "options": "Chapters" + "options": "Chapter Reference" }, { "fieldname": "instructor", @@ -160,9 +160,14 @@ "group": "Mentors", "link_doctype": "LMS Course Mentor Mapping", "link_fieldname": "course" + }, + { + "group": "Interests", + "link_doctype": "LMS Course Interest", + "link_fieldname": "course" } ], - "modified": "2021-08-25 11:04:57.211898", + "modified": "2021-09-20 12:00:18.325579", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/community/lms/doctype/lms_course/lms_course.py b/community/lms/doctype/lms_course/lms_course.py index 385bf762..56330d77 100644 --- a/community/lms/doctype/lms_course/lms_course.py +++ b/community/lms/doctype/lms_course/lms_course.py @@ -176,7 +176,7 @@ class LMSCourse(Document): def get_lesson_details(self, chapter): lessons = [] - lesson_list = frappe.get_all("Lessons", {"parent": chapter.name}, + lesson_list = frappe.get_all("Lesson Reference", {"parent": chapter.name}, ["lesson", "idx"], order_by="idx") for row in lesson_list: lesson_details = frappe.get_doc("Lesson", row.lesson) @@ -213,7 +213,7 @@ class LMSCourse(Document): def get_lesson_index(self, lesson_name): """Returns the {chapter_index}.{lesson_index} for the lesson. """ - lesson = frappe.db.get_value("Lessons", {"lesson": lesson_name}, ["idx", "parent"], as_dict=True) + lesson = frappe.db.get_value("Lesson Reference", {"lesson": lesson_name}, ["idx", "parent"], as_dict=True) if not lesson: return None diff --git a/community/lms/doctype/lms_quiz/lms_quiz.json b/community/lms/doctype/lms_quiz/lms_quiz.json index e76c35a5..a1af03f2 100644 --- a/community/lms/doctype/lms_quiz/lms_quiz.json +++ b/community/lms/doctype/lms_quiz/lms_quiz.json @@ -1,5 +1,6 @@ { "actions": [], + "allow_rename": 1, "autoname": "field:title", "creation": "2021-06-07 10:50:17.893625", "doctype": "DocType", @@ -33,10 +34,11 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2021-07-23 19:06:12.551633", + "modified": "2021-09-20 10:44:15.930892", "modified_by": "Administrator", "module": "LMS", "name": "LMS Quiz", + "naming_rule": "By fieldname", "owner": "Administrator", "permissions": [ { diff --git a/community/lms/widgets/ChapterTeaser.html b/community/lms/widgets/ChapterTeaser.html index 8edfa580..5225d78e 100644 --- a/community/lms/widgets/ChapterTeaser.html +++ b/community/lms/widgets/ChapterTeaser.html @@ -21,7 +21,7 @@
- {% if membership or lesson.include_in_preview or is_instructor %} + {% if membership or lesson.include_in_preview %} {{ lesson.title }} @@ -33,6 +33,15 @@ + {% elif is_instructor and not lesson.include_in_preview %} + + {{ lesson.title }} + + + {% else %}