dashboard and patch for lesson

This commit is contained in:
Jannat Patel
2022-03-14 19:07:02 +05:30
34 changed files with 389 additions and 218 deletions

View File

@@ -59,7 +59,7 @@
"link_fieldname": "chapter"
}
],
"modified": "2022-03-08 15:21:10.389729",
"modified": "2022-03-14 17:57:00.707416",
"modified_by": "Administrator",
"module": "LMS",
"name": "Course Chapter",
@@ -93,6 +93,7 @@
}
],
"search_fields": "title",
"show_title_field_in_link": 1,
"sort_field": "modified",
"sort_order": "DESC",
"states": [],

View File

@@ -9,6 +9,7 @@
"engine": "InnoDB",
"field_order": [
"chapter",
"course",
"include_in_preview",
"column_break_4",
"title",
@@ -69,11 +70,20 @@
{
"fieldname": "help",
"fieldtype": "HTML"
},
{
"fetch_from": "chapter.course",
"fieldname": "course",
"fieldtype": "Link",
"hidden": 1,
"label": "Course",
"options": "LMS Course",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2022-03-08 17:56:50.504143",
"modified": "2022-03-14 18:56:31.969801",
"modified_by": "Administrator",
"module": "LMS",
"name": "Course Lesson",

View File

@@ -1,6 +1,6 @@
{
"actions": [],
"creation": "2021-03-18 19:52:10.673835",
"creation": "2022-02-07 12:01:40.929633",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
@@ -24,8 +24,6 @@
{
"fieldname": "batch",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Batch",
"options": "LMS Batch"
},
@@ -117,7 +115,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2021-12-16 14:49:25.964853",
"modified": "2022-03-09 15:17:15.386067",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch Membership",
@@ -138,5 +136,6 @@
],
"quick_entry": 1,
"sort_field": "modified",
"sort_order": "DESC"
"sort_order": "DESC",
"states": []
}

View File

@@ -20,13 +20,14 @@
"column_break_3",
"instructors",
"tags",
"status",
"section_break_7",
"is_published",
"column_break_9",
"column_break_10",
"upcoming",
"column_break_11",
"column_break_12",
"disable_self_learning",
"section_break_5",
"section_break_18",
"short_introduction",
"description",
"chapters",
@@ -42,7 +43,8 @@
"in_list_view": 1,
"label": "Title",
"reqd": 1,
"unique": 1
"unique": 1,
"width": "200"
},
{
"fieldname": "description",
@@ -65,10 +67,6 @@
"fieldtype": "Data",
"label": "Video Embed Link"
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break"
},
{
"fieldname": "short_introduction",
"fieldtype": "Small Text",
@@ -108,6 +106,7 @@
"fieldtype": "Table MultiSelect",
"in_standard_filter": 1,
"label": "Instructors",
"max_height": "50px",
"options": "Course Instructor"
},
{
@@ -115,14 +114,6 @@
"fieldtype": "Section Break",
"label": "Course Settings"
},
{
"fieldname": "column_break_9",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_11",
"fieldtype": "Column Break"
},
{
"fieldname": "certification_section",
"fieldtype": "Section Break",
@@ -147,6 +138,27 @@
"fieldtype": "Table",
"label": "Related Courses",
"options": "Related Courses"
},
{
"default": "In Progress",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 1,
"label": "Status",
"options": "In Progress\nReady for Review\nApproved",
"read_only": 1
},
{
"fieldname": "section_break_18",
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_10",
"fieldtype": "Column Break"
},
{
"fieldname": "column_break_12",
"fieldtype": "Column Break"
}
],
"is_published_field": "is_published",
@@ -172,7 +184,7 @@
"link_fieldname": "course"
}
],
"modified": "2022-03-08 15:20:58.501082",
"modified": "2022-03-14 17:56:46.514391",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",

View File

@@ -12,6 +12,24 @@ from school.lms.utils import get_chapters
class LMSCourse(Document):
def validate(self):
self.validate_instructors()
self.validate_status()
def validate_instructors(self):
if self.is_new() and not self.instructors:
frappe.get_doc({
"doctype": "Course Instructor",
"instructor": self.owner,
"parent": self.name,
"parentfield": "instructors",
"parenttype": "LMS Course"
}).save(ignore_permissions=True)
def validate_status(self):
if self.is_published:
self.status = "Approved"
def on_update(self):
if not self.upcoming and self.has_value_changed("upcoming"):
self.send_email_to_interested_users()
@@ -184,3 +202,11 @@ def search_course(text):
}) """
return courses
@frappe.whitelist()
def submit_for_review(course):
chapters = frappe.get_all("Chapter Reference", {"parent": course})
if not len(chapters):
return "No Chp"
frappe.db.set_value("LMS Course", course, "status", "Ready for Review")
return "OK"

View File

@@ -12,8 +12,6 @@ class TestLMSCourse(unittest.TestCase):
frappe.db.sql('delete from `tabLMS Course Mentor Mapping`')
frappe.db.sql('delete from `tabLMS Course`')
def test_new_course(self):
course = new_course("Test Course")
assert course.title == "Test Course"

View File

@@ -14,9 +14,12 @@
"signup_settings_section",
"terms_of_use",
"terms_page",
"column_break_12",
"column_break_9",
"privacy_policy",
"privacy_policy_page",
"column_break_12",
"cookie_policy",
"cookie_policy_page",
"mentor_request_section",
"mentor_request_creation",
"mentor_request_status_update"
@@ -97,6 +100,7 @@
"fieldname": "privacy_policy_page",
"fieldtype": "Link",
"label": "Privacy Policy Page",
"mandatory_depends_on": "privacy_policy",
"options": "Web Page"
},
{
@@ -108,6 +112,24 @@
"fieldname": "portal_course_creation",
"fieldtype": "Check",
"label": "Enable Course Creation from Portal"
},
{
"fieldname": "column_break_9",
"fieldtype": "Column Break"
},
{
"default": "0",
"fieldname": "cookie_policy",
"fieldtype": "Check",
"label": "Show Cookie Policy on Signup"
},
{
"depends_on": "cookie_policy",
"fieldname": "cookie_policy_page",
"fieldtype": "Link",
"label": "Cookie Policy Page",
"mandatory_depends_on": "cookie_policy",
"options": "Web Page"
}
],
"index_web_pages_for_search": 1,

View File

@@ -5,9 +5,10 @@
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from frappe import _
class LMSSettings(Document):
pass
pass
@frappe.whitelist()
def check_profile_restriction():