feat: assignments in batches

This commit is contained in:
Jannat Patel
2024-04-05 21:51:18 +05:30
parent 055f917c61
commit 6d75b8a3a2
9 changed files with 402 additions and 18 deletions

View File

@@ -64,7 +64,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-10-06 12:08:46.898950",
"modified": "2024-04-05 12:01:36.601160",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Assignment",
@@ -94,6 +94,15 @@
"role": "Moderator",
"share": 1,
"write": 1
},
{
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS Student",
"share": 1
}
],
"show_title_field_in_link": 1,

View File

@@ -156,7 +156,7 @@
"index_web_pages_for_search": 1,
"links": [],
"make_attachments_public": 1,
"modified": "2023-10-06 15:14:55.984714",
"modified": "2024-04-05 15:57:22.758563",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Assignment Submission",
@@ -174,6 +174,18 @@
"role": "System Manager",
"share": 1,
"write": 1
},
{
"create": 1,
"email": 1,
"export": 1,
"if_owner": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "LMS Student",
"share": 1,
"write": 1
}
],
"sort_field": "modified",

View File

@@ -11,10 +11,15 @@ from frappe.email.doctype.email_template.email_template import get_email_templat
class LMSAssignmentSubmission(Document):
def validate(self):
self.validate_duplicates()
self.validate_url()
def after_insert(self):
if not frappe.flags.in_test:
self.send_mail()
outgoing_email_account = frappe.get_cached_value(
"Email Account", {"default_outgoing": 1, "enable_outgoing": 1}, "name"
)
if outgoing_email_account:
self.send_mail()
def validate_duplicates(self):
if frappe.db.exists(
@@ -28,6 +33,10 @@ class LMSAssignmentSubmission(Document):
)
)
def validate_url(self):
if self.type == "URL" and not validate_url(self.answer):
frappe.throw(_("Please enter a valid URL."))
def send_mail(self):
subject = _("New Assignment Submission")
template = "assignment_submission"