From 11cc03849d4b370fd8807ddcc6f2bd9f251efaea Mon Sep 17 00:00:00 2001 From: pateljannat Date: Thu, 6 May 2021 13:23:22 +0530 Subject: [PATCH] fix: displaying course name in mentor email --- .../doctype/lms_mentor_request/lms_mentor_request.py | 11 ++++++----- .../emails/mentor_request_creation_email.html | 2 +- .../emails/mentor_request_status_update_email.html | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/community/lms/doctype/lms_mentor_request/lms_mentor_request.py b/community/lms/doctype/lms_mentor_request/lms_mentor_request.py index d8b7ca6a..d9162bdf 100644 --- a/community/lms/doctype/lms_mentor_request/lms_mentor_request.py +++ b/community/lms/doctype/lms_mentor_request/lms_mentor_request.py @@ -30,11 +30,12 @@ class LMSMentorRequest(Document): if not email_template: return - course_details = frappe.db.get_value("LMS Course", self.course, ["owner", "slug"], as_dict=True) + course_details = frappe.db.get_value("LMS Course", self.course, ["owner", "slug", "title"], as_dict=True) message = frappe.render_template(email_template.response, { 'member_name': member.full_name, - 'course_url': '/courses/' + course_details.slug + 'course_url': '/courses/' + course_details.slug, + 'course': course_details.title }) email_args = { @@ -50,15 +51,15 @@ class LMSMentorRequest(Document): if not email_template: return + course_details = frappe.db.get_value("LMS Course", self.course, ["owner", "title"], as_dict=True) message = frappe.render_template(email_template.response, { 'member_name': self.member_name, - 'status': self.status + 'status': self.status, + 'course': course_details.title }) member_email = frappe.db.get_value("Community Member", self.member, "email") - course_details = frappe.db.get_value("LMS Course", self.course, ["owner"], as_dict=True) - if self.status == 'Approved' or self.status == 'Rejected': reviewed_by = frappe.db.get_value('Community Member', self.reviewed_by, 'email') email_args = { diff --git a/community/templates/emails/mentor_request_creation_email.html b/community/templates/emails/mentor_request_creation_email.html index 62e13f49..9407d6c4 100644 --- a/community/templates/emails/mentor_request_creation_email.html +++ b/community/templates/emails/mentor_request_creation_email.html @@ -2,7 +2,7 @@

Dear {{ member_name }},


You've applied to become a mentor for this course. Your request is currently under review.

-

If you are not any more interested to mentor this course, you can cancel your application.

+

If you are not any more interested to mentor the course {{ course }}, you can cancel your application.


Thanks and Regards,

Team Community.

diff --git a/community/templates/emails/mentor_request_status_update_email.html b/community/templates/emails/mentor_request_status_update_email.html index bf2878f0..04e65712 100644 --- a/community/templates/emails/mentor_request_status_update_email.html +++ b/community/templates/emails/mentor_request_status_update_email.html @@ -1,7 +1,7 @@

Dear {{ member_name }},


-

Your request to join us as a mentor has been {{ status }}.

+

Your request to join us as a mentor for the course {{ course }} has been {{ status }}.


Thanks and Regards,

Team Community.