fix: renamed chapter and lesson doctype
This commit is contained in:
0
community/lms/doctype/course_chapter/__init__.py
Normal file
0
community/lms/doctype/course_chapter/__init__.py
Normal file
8
community/lms/doctype/course_chapter/course_chapter.js
Normal file
8
community/lms/doctype/course_chapter/course_chapter.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2021, FOSS United and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Course Chapter', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
});
|
||||
86
community/lms/doctype/course_chapter/course_chapter.json
Normal file
86
community/lms/doctype/course_chapter/course_chapter.json
Normal file
@@ -0,0 +1,86 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "CHP.",
|
||||
"creation": "2021-05-03 05:49:08.383057",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"course",
|
||||
"title",
|
||||
"column_break_3",
|
||||
"description",
|
||||
"section_break_5",
|
||||
"lessons"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "course",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Course",
|
||||
"options": "LMS Course",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Title",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"label": "Description"
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_5",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "lessons",
|
||||
"fieldtype": "Table",
|
||||
"label": "Lessons",
|
||||
"options": "Lesson Reference"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [
|
||||
{
|
||||
"group": "Lessons",
|
||||
"link_doctype": "Course Lesson",
|
||||
"link_fieldname": "chapter"
|
||||
}
|
||||
],
|
||||
"modified": "2021-09-29 15:33:44.611221",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Course Chapter",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"search_fields": "title",
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "title",
|
||||
"track_changes": 1
|
||||
}
|
||||
8
community/lms/doctype/course_chapter/course_chapter.py
Normal file
8
community/lms/doctype/course_chapter/course_chapter.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2021, FOSS United and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class CourseChapter(Document):
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2021, FOSS United and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
|
||||
class TestCourseChapter(unittest.TestCase):
|
||||
pass
|
||||
0
community/lms/doctype/course_lesson/__init__.py
Normal file
0
community/lms/doctype/course_lesson/__init__.py
Normal file
8
community/lms/doctype/course_lesson/course_lesson.js
Normal file
8
community/lms/doctype/course_lesson/course_lesson.js
Normal file
@@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2021, FOSS United and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Course Lesson', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
// }
|
||||
});
|
||||
97
community/lms/doctype/course_lesson/course_lesson.json
Normal file
97
community/lms/doctype/course_lesson/course_lesson.json
Normal file
@@ -0,0 +1,97 @@
|
||||
{
|
||||
"actions": [],
|
||||
"allow_rename": 1,
|
||||
"autoname": "LES.",
|
||||
"creation": "2021-05-03 06:21:12.995987",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"chapter",
|
||||
"include_in_preview",
|
||||
"column_break_4",
|
||||
"title",
|
||||
"index_label",
|
||||
"section_break_6",
|
||||
"body",
|
||||
"help_section",
|
||||
"help"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "chapter",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Chapter",
|
||||
"options": "Course Chapter",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "include_in_preview",
|
||||
"fieldtype": "Check",
|
||||
"label": "Include In Preview"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "title",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Title",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "index_label",
|
||||
"fieldtype": "Data",
|
||||
"label": "Index Label",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break_6",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "body",
|
||||
"fieldtype": "Markdown Editor",
|
||||
"label": "Body",
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"fieldname": "help_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Help"
|
||||
},
|
||||
{
|
||||
"fieldname": "help",
|
||||
"fieldtype": "HTML"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-09-29 15:28:51.418015",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Course Lesson",
|
||||
"naming_rule": "Expression",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"share": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
8
community/lms/doctype/course_lesson/course_lesson.py
Normal file
8
community/lms/doctype/course_lesson/course_lesson.py
Normal file
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2021, FOSS United and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class CourseLesson(Document):
|
||||
pass
|
||||
@@ -0,0 +1,8 @@
|
||||
# Copyright (c) 2021, FOSS United and Contributors
|
||||
# See license.txt
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
|
||||
class TestCourseLesson(unittest.TestCase):
|
||||
pass
|
||||
@@ -78,7 +78,7 @@
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Lesson",
|
||||
"options": "Lesson"
|
||||
"options": "Course Lesson"
|
||||
},
|
||||
{
|
||||
"fieldname": "index_",
|
||||
@@ -96,7 +96,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-06-01 05:22:15.656013",
|
||||
"modified": "2021-09-29 15:27:55.585874",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Exercise",
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
"fieldname": "lesson",
|
||||
"fieldtype": "Link",
|
||||
"label": "Lesson",
|
||||
"options": "Lesson"
|
||||
"options": "Course Lesson"
|
||||
},
|
||||
{
|
||||
"fieldname": "image",
|
||||
@@ -94,7 +94,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-06-24 16:22:50.570845",
|
||||
"modified": "2021-09-29 15:27:57.273879",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Exercise Submission",
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
"fieldname": "current_lesson",
|
||||
"fieldtype": "Link",
|
||||
"label": "Current Lesson",
|
||||
"options": "Lesson"
|
||||
"options": "Course Lesson"
|
||||
},
|
||||
{
|
||||
"fetch_from": "member.username",
|
||||
@@ -84,7 +84,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-08-04 17:10:42.708479",
|
||||
"modified": "2021-09-29 15:27:58.765399",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Batch Membership",
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Chapter",
|
||||
"options": "Chapter",
|
||||
"options": "Course Chapter",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
@@ -53,7 +53,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-06-02 13:05:31.114939",
|
||||
"modified": "2021-09-29 15:26:43.911664",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course Progress",
|
||||
|
||||
@@ -12,3 +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
|
||||
|
||||
30
community/patches/v0_0/rename_chapter_and_lesson_doctype.py
Normal file
30
community/patches/v0_0/rename_chapter_and_lesson_doctype.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("lms", "doctype", "course_chapter")
|
||||
frappe.reload_doc("lms", "doctype", "course_lesson")
|
||||
|
||||
if not frappe.db.count("Course Chapter"):
|
||||
move_chapters()
|
||||
|
||||
if not frappe.db.count("Course Lesson"):
|
||||
move_lessons()
|
||||
|
||||
frappe.delete_doc("DocType", "Chapter")
|
||||
frappe.delete_doc("DocType", "Lesson")
|
||||
|
||||
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()
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user