From eab0b833a1b29155849361b28c23139dfdbb9423 Mon Sep 17 00:00:00 2001 From: scmmishra Date: Fri, 12 Oct 2018 15:12:04 +0530 Subject: [PATCH] Modified Student Course Activity Doctype Co-authored-by: Chinmay Pai --- .../doctype/lms_activity/lms_activity.json | 128 ++++++++++++++++-- .../student_course_activity.json | 33 ++++- .../student_course_activity.py | 9 +- 3 files changed, 144 insertions(+), 26 deletions(-) diff --git a/erpnext/education/doctype/lms_activity/lms_activity.json b/erpnext/education/doctype/lms_activity/lms_activity.json index f7bc30b10a..494b0ac17f 100644 --- a/erpnext/education/doctype/lms_activity/lms_activity.json +++ b/erpnext/education/doctype/lms_activity/lms_activity.json @@ -36,7 +36,41 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fetch_from": "content_name.content_type", + "fieldname": "content_type", + "fieldtype": "Data", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 1, + "in_standard_filter": 0, + "label": "Content Type", + "length": 0, + "no_copy": 0, + "options": "", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, @@ -53,7 +87,7 @@ "collapsible": 0, "columns": 0, "fetch_from": "", - "fieldname": "lesson_name", + "fieldname": "content_name", "fieldtype": "Link", "hidden": 0, "ignore_user_permissions": 0, @@ -62,7 +96,7 @@ "in_global_search": 0, "in_list_view": 1, "in_standard_filter": 0, - "label": "Lesson Name", + "label": "Content Name", "length": 0, "no_copy": 0, "options": "Content", @@ -70,6 +104,73 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "columns": 0, + "fieldname": "status", + "fieldtype": "Select", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Status", + "length": 0, + "no_copy": 0, + "options": "\nCompleted\nPassed\nFailed", + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, + "read_only": 1, + "remember_last_selected_value": 0, + "report_hide": 0, + "reqd": 0, + "search_index": 0, + "set_only_once": 0, + "translatable": 0, + "unique": 0 + }, + { + "allow_bulk_edit": 0, + "allow_in_quick_entry": 0, + "allow_on_submit": 0, + "bold": 0, + "collapsible": 0, + "collapsible_depends_on": "", + "columns": 0, + "depends_on": "eval:doc.content_type == \"Quiz\"", + "fieldname": "quiz_section_section", + "fieldtype": "Section Break", + "hidden": 0, + "ignore_user_permissions": 0, + "ignore_xss_filter": 0, + "in_filter": 0, + "in_global_search": 0, + "in_list_view": 0, + "in_standard_filter": 0, + "label": "Quiz Section", + "length": 0, + "no_copy": 0, + "permlevel": 0, + "precision": "", + "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "remember_last_selected_value": 0, "report_hide": 0, @@ -102,12 +203,12 @@ "precision": "", "print_hide": 0, "print_hide_if_no_value": 0, - "read_only": 0, + "read_only": 1, "remember_last_selected_value": 0, "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0, + "set_only_once": 1, "translatable": 0, "unique": 0 }, @@ -118,9 +219,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "default": "Unattempted", - "fieldname": "quiz_status", - "fieldtype": "Select", + "fieldname": "selected_options", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -128,10 +228,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Quiz Status", + "label": "Selected Options", "length": 0, "no_copy": 0, - "options": "\nUnattempted\nPassed\nFailed", "permlevel": 0, "precision": "", "print_hide": 0, @@ -152,8 +251,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "lesson_status", - "fieldtype": "Select", + "fieldname": "result", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -161,10 +260,9 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Lesson Status", + "label": "Result", "length": 0, "no_copy": 0, - "options": "\nOngoing\nCompleted", "permlevel": 0, "precision": "", "print_hide": 0, @@ -189,7 +287,7 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2018-10-08 12:48:34.394511", + "modified": "2018-10-12 13:06:17.568571", "modified_by": "Administrator", "module": "Education", "name": "LMS Activity", diff --git a/erpnext/education/doctype/student_course_activity/student_course_activity.json b/erpnext/education/doctype/student_course_activity/student_course_activity.json index 1d8f98d0b1..c957be7a01 100644 --- a/erpnext/education/doctype/student_course_activity/student_course_activity.json +++ b/erpnext/education/doctype/student_course_activity/student_course_activity.json @@ -3,7 +3,7 @@ "allow_guest_to_view": 0, "allow_import": 0, "allow_rename": 0, - "autoname": "format:{student_name}-{program_name}", + "autoname": "format:{student_id}-{program_name}", "beta": 0, "creation": "2018-10-01 17:35:54.391413", "custom": 0, @@ -20,8 +20,8 @@ "bold": 0, "collapsible": 0, "columns": 0, - "fieldname": "student_name", - "fieldtype": "Link", + "fieldname": "student_id", + "fieldtype": "Data", "hidden": 0, "ignore_user_permissions": 0, "ignore_xss_filter": 0, @@ -29,7 +29,7 @@ "in_global_search": 0, "in_list_view": 0, "in_standard_filter": 0, - "label": "Student Name", + "label": "Student ID", "length": 0, "no_copy": 0, "options": "Student", @@ -42,7 +42,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0, + "set_only_once": 1, "translatable": 0, "unique": 0 }, @@ -75,7 +75,7 @@ "report_hide": 0, "reqd": 0, "search_index": 0, - "set_only_once": 0, + "set_only_once": 1, "translatable": 0, "unique": 0 }, @@ -123,7 +123,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2018-10-08 12:10:28.602848", + "modified": "2018-10-12 13:51:08.729074", "modified_by": "Administrator", "module": "Education", "name": "Student Course Activity", @@ -148,6 +148,25 @@ "share": 1, "submit": 0, "write": 1 + }, + { + "amend": 0, + "cancel": 0, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "if_owner": 0, + "import": 0, + "permlevel": 0, + "print": 1, + "read": 1, + "report": 1, + "role": "LMS User", + "set_user_permissions": 0, + "share": 1, + "submit": 0, + "write": 1 } ], "quick_entry": 1, diff --git a/erpnext/education/doctype/student_course_activity/student_course_activity.py b/erpnext/education/doctype/student_course_activity/student_course_activity.py index bf5778fc36..478e309122 100644 --- a/erpnext/education/doctype/student_course_activity/student_course_activity.py +++ b/erpnext/education/doctype/student_course_activity/student_course_activity.py @@ -12,10 +12,11 @@ class StudentCourseActivity(Document): # self.check_if_course_present() def check_if_enrolled(self): - programs_list = frappe.get_list("Program Enrollment", filters={'student': self.student_name}, fields=['program']) - programs_enrolled_by_student = [item.program for item in programs_list] - if self.program_name not in programs_enrolled_by_student: - frappe.throw("Student {0} is not enrolled in program {1} ".format(self.student_name, self.program_name)) + pass + # programs_list = frappe.get_list("Program Enrollment", filters={'student': self.student_id}, fields=['program']) + # programs_enrolled_by_student = [item.program for item in programs_list] + # if self.program_name not in programs_enrolled_by_student: + # frappe.throw("Student {0} is not enrolled in program {1} ".format(self.student_id, self.program_name)) # def check_if_course_present(self): # """ Get set of unique courses from lms_activity child table and make a list of it as assign it to course_list"""