fix: course page

This commit is contained in:
pateljannat
2021-08-20 14:23:18 +05:30
parent eaec991f47
commit c6d3994383
9 changed files with 54 additions and 22 deletions

View File

@@ -8,7 +8,9 @@
"field_order": [
"course",
"title",
"column_break_3",
"description",
"section_break_5",
"lessons"
],
"fields": [
@@ -20,7 +22,7 @@
},
{
"fieldname": "description",
"fieldtype": "Markdown Editor",
"fieldtype": "Small Text",
"label": "Description"
},
{
@@ -35,6 +37,14 @@
"fieldtype": "Table",
"label": "Lessons",
"options": "Lessons"
},
{
"fieldname": "column_break_3",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_5",
"fieldtype": "Section Break"
}
],
"index_web_pages_for_search": 1,
@@ -45,7 +55,7 @@
"link_fieldname": "chapter"
}
],
"modified": "2021-07-27 16:28:08.667964",
"modified": "2021-08-19 13:43:51.025072",
"modified_by": "Administrator",
"module": "LMS",
"name": "Chapter",

View File

@@ -4,6 +4,7 @@
frappe.ui.form.on('LMS Course', {
onload: function (frm) {
frm.set_query("chapter", "chapters", function () {
return {
filters: {
@@ -11,6 +12,14 @@ frappe.ui.form.on('LMS Course', {
}
};
});
frm.set_query("instructor", function (doc) {
return {
filters: {
"ignore_user_type": 1,
}
};
});
}
});

View File

@@ -18,17 +18,18 @@
"video_link",
"image",
"column_break_3",
"instructor",
"tags",
"section_break_7",
"is_published",
"column_break_9",
"upcoming",
"column_break_11",
"disable_self_learning",
"section_break_5",
"short_introduction",
"description",
"chapters",
"certification_section",
"enable_certification",
"expiry"
"chapters"
],
"fields": [
{
@@ -99,23 +100,25 @@
"options": "Chapters"
},
{
"fieldname": "certification_section",
"fieldname": "instructor",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Instructor",
"options": "User"
},
{
"fieldname": "section_break_7",
"fieldtype": "Section Break",
"label": "Certification"
"label": "Course Settings"
},
{
"default": "0",
"fieldname": "enable_certification",
"fieldtype": "Check",
"label": "Enable Certification"
"fieldname": "column_break_9",
"fieldtype": "Column Break"
},
{
"default": "0",
"depends_on": "enable_certification",
"fieldname": "expiry",
"fieldtype": "Select",
"label": "Certification Expires After Years",
"options": "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10"
"fieldname": "column_break_11",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
@@ -137,7 +140,7 @@
"link_fieldname": "course"
}
],
"modified": "2021-08-18 18:02:12.623807",
"modified": "2021-08-20 11:01:15.795219",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Course",

View File

@@ -144,6 +144,8 @@ class LMSCourse(Document):
return batch_name and frappe.get_doc("LMS Batch", batch_name)
def get_instructor(self):
if self.instructor:
return frappe.get_doc("User", self.instructor)
return frappe.get_doc("User", self.owner)
def get_chapters(self):