feat: notification on assignment submission

This commit is contained in:
Jannat Patel
2023-03-27 17:32:43 +05:30
parent 72cbbf147f
commit 1a8d113ad8
7 changed files with 65 additions and 3 deletions

View File

@@ -9,6 +9,7 @@
"assignment",
"lesson",
"course",
"evaluator",
"status",
"column_break_3",
"member",
@@ -56,10 +57,11 @@
{
"fetch_from": "lesson.course",
"fieldname": "course",
"fieldtype": "Data",
"fieldtype": "Link",
"in_list_view": 1,
"in_standard_filter": 1,
"label": "Course",
"options": "LMS Course",
"read_only": 1
},
{
@@ -73,12 +75,20 @@
"fieldname": "comments",
"fieldtype": "Small Text",
"label": "Comments"
},
{
"fetch_from": "course.evaluator",
"fieldname": "evaluator",
"fieldtype": "Link",
"label": "Evaluator",
"options": "User",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"make_attachments_public": 1,
"modified": "2022-11-16 12:11:59.472025",
"modified": "2023-03-27 13:24:18.696868",
"modified_by": "Administrator",
"module": "LMS",
"name": "Lesson Assignment",

View File

@@ -0,0 +1,27 @@
{
"attach_print": 0,
"channel": "Email",
"creation": "2023-03-27 16:34:03.505645",
"days_in_advance": 0,
"docstatus": 0,
"doctype": "Notification",
"document_type": "Lesson Assignment",
"enabled": 1,
"event": "New",
"idx": 0,
"is_standard": 1,
"message": "<h3> {{ _(\"Assignment Submission\") }}\n\n{% set title = frappe.db.get_value(\"Course Lesson\", doc.lesson, \"title\") %}\n\n<p> {{ _(\"{0} has submitted their assignment for the lesson {1}\").format(doc.member_name, title) }} </p>\n\n <p> {{ _(\" Please evaluate and grade the assignment. \") }} </p>",
"modified": "2023-03-27 16:46:44.564007",
"modified_by": "Administrator",
"module": "LMS",
"name": "Assignment Submission Notification",
"owner": "Administrator",
"recipients": [
{
"receiver_by_document_field": "evaluator"
}
],
"send_system_notification": 0,
"send_to_all_assignees": 0,
"subject": "Assignment Submission"
}

View File

@@ -0,0 +1,10 @@
<div style="background-color: #f4f5f6; padding: 1rem;">
<div style="background-color: #ffffff; width: 75%; margin: 0 auto; padding: 1rem;">
<h3> {{ _("Assignment Submission") }} </h3>
{% set title = frappe.db.get_value("Course Lesson", doc.lesson, "title") %}
<p> {{ _("{0} has submitted their assignment for the lesson {1}").format(frappe.bold(doc.member_name), frappe.bold(title)) }}
</p>
<p> {{ _(" Please evaluate and grade the assignment.") }} </p>
</div>
</div>

View File

@@ -0,0 +1,6 @@
import frappe
def get_context(context):
# do your magic here
pass

View File

@@ -48,4 +48,5 @@ lms.patches.v0_0.user_singles_issue #23-11-2022
lms.patches.v0_0.rename_community_to_users #06-01-2023
lms.patches.v0_0.video_embed_link
lms.patches.v0_0.rename_exercise_doctype
lms.patches.v0_0.add_question_type
lms.patches.v0_0.add_question_type
lms.patches.v0_0.add_evaluator_to_assignment

View File

@@ -0,0 +1,8 @@
import frappe
def execute():
assignments = frappe.get_all("Lesson Assignment", fields=["name", "course"])
for assignment in assignments:
evaluator = frappe.db.get_value("LMS Course", assignment.course, "evaluator")
frappe.db.set_value("Lesson Assignment", assignment.name, "evaluator", evaluator)