feat: assessment tab in class
This commit is contained in:
35
lms/www/assignment_grading/assignment_grading.py
Normal file
35
lms/www/assignment_grading/assignment_grading.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import frappe
|
||||
from lms.lms.utils import has_course_moderator_role
|
||||
from frappe import _
|
||||
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
assignment = frappe.form_dict["assignment"]
|
||||
|
||||
context.assignment = frappe.db.get_value(
|
||||
"LMS Assignment Submission",
|
||||
assignment,
|
||||
[
|
||||
"assignment",
|
||||
"comments",
|
||||
"status",
|
||||
"name",
|
||||
"member",
|
||||
"member_name",
|
||||
"course",
|
||||
"lesson",
|
||||
],
|
||||
as_dict=True,
|
||||
)
|
||||
context.is_moderator = has_course_moderator_role()
|
||||
|
||||
if (
|
||||
not has_course_moderator_role()
|
||||
and not frappe.session.user == context.assignment.member
|
||||
):
|
||||
message = "You don't have the permissions to access this page."
|
||||
if frappe.session.user == "Guest":
|
||||
message = "Please login to access this page."
|
||||
|
||||
raise frappe.PermissionError(_(message))
|
||||
Reference in New Issue
Block a user