From 86e9739218ba4fea078033f6b079e94c7a03bd0d Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 6 Sep 2024 10:19:25 +0530 Subject: [PATCH 1/2] fix: certificate request creation email --- .../lms_certificate_request.py | 8 ++--- .../certificate_request_creation/__init__.py | 0 .../certificate_request_creation.html | 7 ---- .../certificate_request_creation.json | 34 ------------------- .../certificate_request_creation.py | 6 ---- lms/patches.txt | 3 +- ...delete_certificate_request_notification.py | 4 +++ .../certificate_request_notification.html | 5 ++- 8 files changed, 13 insertions(+), 54 deletions(-) delete mode 100644 lms/lms/notification/certificate_request_creation/__init__.py delete mode 100644 lms/lms/notification/certificate_request_creation/certificate_request_creation.html delete mode 100644 lms/lms/notification/certificate_request_creation/certificate_request_creation.json delete mode 100644 lms/lms/notification/certificate_request_creation/certificate_request_creation.py create mode 100644 lms/patches/v2_0/delete_certificate_request_notification.py diff --git a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py index 3111b8364..ab88fc085 100644 --- a/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py +++ b/lms/lms/doctype/lms_certificate_request/lms_certificate_request.py @@ -124,14 +124,12 @@ def send_notification(self): template = "certificate_request_notification" args = { - "course": frappe.db.get_value("LMS Course", self.course, "title"), - "timezone": frappe.db.get_value("LMS Batch", self.batch_name, "timezone") - if self.batch_name - else "", + "course": self.course_title, + "timezone": self.timezone if self.batch_name else "", "date": format_date(self.date, "medium"), "member_name": self.member_name, "start_time": format_time(self.start_time, "short"), - "evaluator": frappe.db.get_value("User", self.evaluator, "full_name"), + "evaluator": self.evaluator_name, } frappe.sendmail( diff --git a/lms/lms/notification/certificate_request_creation/__init__.py b/lms/lms/notification/certificate_request_creation/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/lms/lms/notification/certificate_request_creation/certificate_request_creation.html b/lms/lms/notification/certificate_request_creation/certificate_request_creation.html deleted file mode 100644 index 8906e3e9c..000000000 --- a/lms/lms/notification/certificate_request_creation/certificate_request_creation.html +++ /dev/null @@ -1,7 +0,0 @@ -

{{ _("Hey {0}").format(doc.member_name) }}

-
-

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(doc.course_title, frappe.utils.format_date(doc.date, "medium"), frappe.utils.format_time(doc.start_time, "short"), doc.timezone) }}

-
-

{{ _("{0} is your evaluator").format(doc.evaluator_name) }}

-
-

{{ _("Please prepare well and be on time for the evaluations.") }}

diff --git a/lms/lms/notification/certificate_request_creation/certificate_request_creation.json b/lms/lms/notification/certificate_request_creation/certificate_request_creation.json deleted file mode 100644 index b1220cd45..000000000 --- a/lms/lms/notification/certificate_request_creation/certificate_request_creation.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "attach_print": 0, - "channel": "Email", - "creation": "2022-06-03 11:02:34.579145", - "days_in_advance": 0, - "docstatus": 0, - "doctype": "Notification", - "document_type": "LMS Certificate Request", - "enabled": 1, - "event": "New", - "idx": 0, - "is_standard": 1, - "message": "

{{ _(\"Hey {0}\").format(doc.member_name) }}

\n
\n

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(doc.course_title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\"), doc.timezone) }}

\n
\n

{{ _(\"{0} is your evaluator\").format(doc.evaluator_name) }}

\n
\n

{{ _(\"Please prepare well and be on time for the evaluations.\") }}

\n", - "message_type": "HTML", - "modified": "2024-09-05 16:33:01.533349", - "modified_by": "Administrator", - "module": "LMS", - "name": "Certificate Request Creation", - "owner": "Administrator", - "recipients": [ - { - "receiver_by_document_field": "member" - }, - { - "receiver_by_document_field": "evaluator" - }, - { - "receiver_by_role": "Frappe School Admin" - } - ], - "send_system_notification": 0, - "send_to_all_assignees": 0, - "subject": "Your evaluation slot has been booked" -} \ No newline at end of file diff --git a/lms/lms/notification/certificate_request_creation/certificate_request_creation.py b/lms/lms/notification/certificate_request_creation/certificate_request_creation.py deleted file mode 100644 index 80b7b8735..000000000 --- a/lms/lms/notification/certificate_request_creation/certificate_request_creation.py +++ /dev/null @@ -1,6 +0,0 @@ -import frappe - - -def get_context(context): - # do your magic here - pass diff --git a/lms/patches.txt b/lms/patches.txt index 0c9109ac2..74a76ef96 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -89,4 +89,5 @@ lms.patches.v1_0.change_navbar_urls lms.patches.v1_0.set_published_on lms.patches.v2_0.fix_progress_percentage lms.patches.v2_0.add_discussion_topic_titles -lms.patches.v2_0.sidebar_settings \ No newline at end of file +lms.patches.v2_0.sidebar_settings +lms.patches.v2_0.delete_certificate_request_notification \ No newline at end of file diff --git a/lms/patches/v2_0/delete_certificate_request_notification.py b/lms/patches/v2_0/delete_certificate_request_notification.py new file mode 100644 index 000000000..626dbaf0e --- /dev/null +++ b/lms/patches/v2_0/delete_certificate_request_notification.py @@ -0,0 +1,4 @@ +import frappe + +def execute(): + frappe.db.delete("Notification", "Certificate Request Creation") \ No newline at end of file diff --git a/lms/templates/emails/certificate_request_notification.html b/lms/templates/emails/certificate_request_notification.html index 6e4309bc1..5b3d027ca 100644 --- a/lms/templates/emails/certificate_request_notification.html +++ b/lms/templates/emails/certificate_request_notification.html @@ -1,4 +1,7 @@

{{ _("Hey {0}").format(member_name) }}

-

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(title, date, start_time, timezone) }}

+
+

{{ _('Your evaluation for the course {0} has been scheduled on {1} at {2} {3}.').format(course, date, start_time, timezone) }}

+

{{ _("Your evaluator is {0}").format(evaluator) }}

+

{{ _("Please prepare well and be on time for the evaluations.") }}

From 050084e552402ee4e9b7459618894900f9c36f9c Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Fri, 6 Sep 2024 10:40:25 +0530 Subject: [PATCH 2/2] style: fix formatting --- lms/patches/v2_0/delete_certificate_request_notification.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lms/patches/v2_0/delete_certificate_request_notification.py b/lms/patches/v2_0/delete_certificate_request_notification.py index 626dbaf0e..53b907df3 100644 --- a/lms/patches/v2_0/delete_certificate_request_notification.py +++ b/lms/patches/v2_0/delete_certificate_request_notification.py @@ -1,4 +1,5 @@ import frappe + def execute(): - frappe.db.delete("Notification", "Certificate Request Creation") \ No newline at end of file + frappe.db.delete("Notification", "Certificate Request Creation")