diff --git a/lms/lms/doctype/lms_assignment/lms_assignment.json b/lms/lms/doctype/lms_assignment/lms_assignment.json index e7659c04..0dde9649 100644 --- a/lms/lms/doctype/lms_assignment/lms_assignment.json +++ b/lms/lms/doctype/lms_assignment/lms_assignment.json @@ -46,7 +46,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-05-29 14:50:55.259990", + "modified": "2023-06-23 12:34:21.314971", "modified_by": "Administrator", "module": "LMS", "name": "LMS Assignment", @@ -64,9 +64,22 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Moderator", + "share": 1, + "write": 1 } ], "sort_field": "modified", "sort_order": "DESC", - "states": [] + "states": [], + "title_field": "title" } \ No newline at end of file diff --git a/lms/lms/doctype/lms_class/lms_class.json b/lms/lms/doctype/lms_class/lms_class.json index 6a69486d..3f3b61e3 100644 --- a/lms/lms/doctype/lms_class/lms_class.json +++ b/lms/lms/doctype/lms_class/lms_class.json @@ -50,7 +50,8 @@ { "fieldname": "description", "fieldtype": "Small Text", - "label": "Description" + "label": "Description", + "reqd": 1 }, { "fieldname": "section_break_6", @@ -137,7 +138,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-06-15 12:30:26.929156", + "modified": "2023-06-22 15:57:25.190084", "modified_by": "Administrator", "module": "LMS", "name": "LMS Class", diff --git a/lms/lms/doctype/lms_class/lms_class.py b/lms/lms/doctype/lms_class/lms_class.py index 634f41e6..5c7a3cae 100644 --- a/lms/lms/doctype/lms_class/lms_class.py +++ b/lms/lms/doctype/lms_class/lms_class.py @@ -8,6 +8,7 @@ from frappe.utils import cint, format_date, format_datetime import requests import base64 import json +from lms.lms.utils import has_course_moderator_role class LMSClass(Document): @@ -188,6 +189,9 @@ def create_class( @frappe.whitelist() def update_assessment(type, name, value, class_name): + if not has_course_moderator_role(): + return + value = cint(value) filters = { "assessment_type": type, diff --git a/lms/lms/doctype/lms_quiz/lms_quiz.json b/lms/lms/doctype/lms_quiz/lms_quiz.json index 7f3a8d48..39e9b282 100644 --- a/lms/lms/doctype/lms_quiz/lms_quiz.json +++ b/lms/lms/doctype/lms_quiz/lms_quiz.json @@ -70,7 +70,7 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2023-06-21 09:13:01.322701", + "modified": "2023-06-23 12:35:25.204131", "modified_by": "Administrator", "module": "LMS", "name": "LMS Quiz", @@ -87,6 +87,18 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "Moderator", + "share": 1, + "write": 1 } ], "show_title_field_in_link": 1, diff --git a/lms/lms/utils.py b/lms/lms/utils.py index 522084fe..6e2d981d 100644 --- a/lms/lms/utils.py +++ b/lms/lms/utils.py @@ -733,3 +733,23 @@ def is_onboarding_complete(): if course_created else None, } + + +def has_submitted_assessment(assessment, type, member=None): + if not member: + member = frappe.session.user + + doctype = ( + "LMS Assignment Submission" if type == "LMS Assignment" else "LMS Quiz Submission" + ) + docfield = "assignment" if type == "LMS Assignment" else "quiz" + + filters = {} + filters[docfield] = assessment + filters["member"] = member + return frappe.db.exists(doctype, filters) + + +def has_graded_assessment(submission): + status = frappe.db.get_value("LMS Assignment Submission", submission, "status") + return False if status == "Not Graded" else True diff --git a/lms/lms/widgets/CourseCard.html b/lms/lms/widgets/CourseCard.html index 78472396..486471c9 100644 --- a/lms/lms/widgets/CourseCard.html +++ b/lms/lms/widgets/CourseCard.html @@ -72,6 +72,9 @@ {% endif %}
{{ _("Select the assessments you wish to include for this class. Your selections will be automatically saved upon clicking. If you decide to remove an item from the list, simply uncheck it.") }}
-{{ _("No Assessments") }}
@@ -376,7 +456,6 @@ {% macro CreateLiveClass(class_info) %} - {% if is_moderator %}{{ _("No Live Classes") }}
+{{ _("No Live Classes") }}
{% endif %}