fix: batch reminder email subject and content

This commit is contained in:
Jannat Patel
2025-03-13 06:08:00 +05:30
parent efb694a6e6
commit 4a0812dfe9
6 changed files with 28 additions and 18 deletions

View File

@@ -1,6 +1,12 @@
<template>
<Button v-if="certification.data && certification.data.certificate" @click="downloadCertificate" class="w-full">
<template #prefix>
<GraduationCap class="size-4 stroke-1.5" />
</template>
{{ __('View Certificate') }}
</Button>
<div
v-if="
v-else-if="
certification.data &&
certification.data.membership &&
certification.data.paid_certificate &&
@@ -25,7 +31,7 @@
</Button>
</router-link>
<router-link
v-else-if="!certification.data.membership.certficate"
v-else-if="!certification.data.membership.certificate"
:to="{
name: 'CourseCertification',
params: {
@@ -64,4 +70,12 @@ const certification = createResource({
auto: true,
cache: ['certificationData', user.data?.name],
})
const downloadCertificate = () => {
window.open(
`/api/method/frappe.utils.print_format.download_pdf?doctype=LMS+Certificate&name=${
certification.data.certificate.name
}&format=${encodeURIComponent(certification.data.certificate.template)}`,
)
}
</script>

View File

@@ -1295,13 +1295,14 @@ def get_certification_details(course):
membership = frappe.db.get_value(
"LMS Enrollment",
filters,
["name", "certificate", "purchased_certificate"],
["name", "purchased_certificate"],
as_dict=1,
)
paid_certificate = frappe.db.get_value("LMS Course", course, "paid_certificate")
certificate = frappe.db.get_value("LMS Certificate", {"member": frappe.session.user, "course": course}, ["name", "template"], as_dict=1)
return {"membership": membership, "paid_certificate": paid_certificate}
return {"membership": membership, "paid_certificate": paid_certificate, "certificate": certificate}
@frappe.whitelist()

View File

@@ -408,14 +408,14 @@ def send_batch_start_reminder():
for batch in batches:
students = frappe.get_all(
"LMS Batch Enrollment", {"batch": batch}, ["member", "member_name"]
"LMS Batch Enrollment", {"batch": batch.name}, ["member", "member_name"]
)
for student in students:
send_mail(batch, student)
def send_mail(batch, student):
subject = _("Batch Start Reminder")
subject = _("Your batch {0} is starting tomorrow").format(batch.title)
template = "batch_start_reminder"
args = {

View File

@@ -84,7 +84,7 @@ def send_live_class_reminder():
def send_mail(live_class, student):
subject = f"Your class on {live_class.title} is tomorrow"
subject = _("Your class on {0} is today").format(live_class.title)
template = "live_class_reminder"
args = {

View File

@@ -9,23 +9,20 @@
<p>
<b>{{ _("Batch:") }}</b> {{ title }}
</p>
<br>
<p>
<b>{{ _("Start Date:") }}</b> {{ frappe.utils.format_date(start_date, "medium") }}
<b>{{ _("Start Date:") }}</b> {{ frappe.utils.format_date(start_date, "long") }}
</p>
<br>
<p>
<b>{{ _("Timings:") }}</b> {{ frappe.utils.format_time(start_time, "hh:mm a") }}
</p>
<br>
<p>
<b>{{ _("Medium:") }}</b> {{ medium }}
</p>
<br>
<p>
{{ _("Visit the following link to view your ") }}
<a href="/lms/batches/{{ name }}">{{ _("Batch Details") }}</a>
<a href="/lms/batches/{{ name }}">👉 {{ _("Visit your batch") }}</a>
</p>
<br>
<p>
{{ _("If you have any questions or require assistance, feel free to contact us.") }}
</p>

View File

@@ -9,19 +9,17 @@
<p>
<b>{{ _("Class:") }}</b> {{ title }}
</p>
<br>
<p>
<b>{{ _("Date:") }}</b> {{ frappe.utils.format_date(date, "medium") }}
<b>{{ _("Date:") }}</b> {{ frappe.utils.format_date(date, "long") }}
</p>
<br>
<p>
<b>{{ _("Timings:") }}</b> {{ frappe.utils.format_time(time, "hh:mm a") }}
</p>
<br>
<p>
{{ _("Visit the following link to view your ") }}
<a href="/lms/live_classes/{{ batch_name }}">{{ _("Batch Details") }}</a>
<a href="/lms/batches/{{ batch_name }}">👉 {{ _("Visit your batch") }}</a>
</p>
<br>
<p>
{{ _("If you have any questions or require assistance, feel free to contact us.") }}
</p>