fix: misc batch issues
This commit is contained in:
@@ -78,7 +78,7 @@
|
|||||||
<template #prefix>
|
<template #prefix>
|
||||||
<div v-if="column.key == 'member_name'">
|
<div v-if="column.key == 'member_name'">
|
||||||
<Avatar
|
<Avatar
|
||||||
class="flex items-center"
|
class="flex"
|
||||||
:image="row['member_image']"
|
:image="row['member_image']"
|
||||||
:label="item"
|
:label="item"
|
||||||
size="sm"
|
size="sm"
|
||||||
@@ -240,6 +240,6 @@ const feedbackColumns = computed(() => {
|
|||||||
<style>
|
<style>
|
||||||
.feedback-list > button > div {
|
.feedback-list > button > div {
|
||||||
align-items: start;
|
align-items: start;
|
||||||
padding: 0.25rem 0;
|
padding: 0.15rem 0;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@
|
|||||||
:options="chartOptions"
|
:options="chartOptions"
|
||||||
:series="chartData"
|
:series="chartData"
|
||||||
type="bar"
|
type="bar"
|
||||||
height="200"
|
:height="chartData[0].data.length * 30 + 100"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
class="flex items-center justify-center text-sm text-ink-gray-7 space-x-4"
|
class="flex items-center justify-center text-sm text-ink-gray-7 space-x-4"
|
||||||
@@ -357,7 +357,7 @@ const getChartData = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Object.keys(student.assessments).forEach((assessment) => {
|
Object.keys(student.assessments).forEach((assessment) => {
|
||||||
if (student.assessments[assessment].result === 'Passed') {
|
if (student.assessments[assessment].result === 'Pass') {
|
||||||
categories[assessment].value += 1
|
categories[assessment].value += 1
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -67,13 +67,16 @@ const announcement = reactive({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const announcementResource = createResource({
|
const announcementResource = createResource({
|
||||||
url: 'lms.lms.api.make_announcement',
|
url: 'frappe.core.doctype.communication.email.make',
|
||||||
makeParams(values) {
|
makeParams(values) {
|
||||||
return {
|
return {
|
||||||
students: props.students,
|
recipients: props.students.join(', '),
|
||||||
cc: announcement.replyTo,
|
cc: announcement.replyTo,
|
||||||
subject: announcement.subject,
|
subject: announcement.subject,
|
||||||
content: announcement.announcement,
|
content: announcement.announcement,
|
||||||
|
doctype: 'LMS Batch',
|
||||||
|
name: props.batch,
|
||||||
|
send_email: 1,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -32,25 +32,44 @@
|
|||||||
{{ __('Assessment') }}
|
{{ __('Assessment') }}
|
||||||
</span>
|
</span>
|
||||||
<span>
|
<span>
|
||||||
{{ __('Progress') }}
|
{{ __('Percentage/Status') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<router-link
|
||||||
v-for="assessment in Object.keys(student.assessments)"
|
v-for="assessment in Object.keys(student.assessments)"
|
||||||
class="flex items-center text-ink-gray-7 font-medium"
|
class="flex items-center text-ink-gray-7 font-medium"
|
||||||
|
:to="{
|
||||||
|
name:
|
||||||
|
student.assessments[assessment].type == 'LMS Assignment'
|
||||||
|
? 'AssignmentSubmission'
|
||||||
|
: '',
|
||||||
|
params:
|
||||||
|
student.assessments[assessment].type == 'LMS Assignment'
|
||||||
|
? {
|
||||||
|
assignmentID:
|
||||||
|
student.assessments[assessment].assessment,
|
||||||
|
submissionName:
|
||||||
|
student.assessments[assessment].submission,
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<span class="flex-1">
|
<span class="flex-1">
|
||||||
{{ assessment }}
|
{{ assessment }}
|
||||||
</span>
|
</span>
|
||||||
<span v-if="isAssignment(student.assessments[assessment])">
|
<span v-if="isAssignment(student.assessments[assessment].status)">
|
||||||
<Badge :theme="getStatusTheme(student.assessments[assessment])">
|
<Badge
|
||||||
{{ student.assessments[assessment] }}
|
:theme="
|
||||||
|
getStatusTheme(student.assessments[assessment].status)
|
||||||
|
"
|
||||||
|
>
|
||||||
|
{{ student.assessments[assessment].status }}
|
||||||
</Badge>
|
</Badge>
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
{{ student.assessments[assessment] }}
|
{{ student.assessments[assessment].status }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</router-link>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Courses -->
|
<!-- Courses -->
|
||||||
|
|||||||
@@ -127,6 +127,11 @@ const batch = createResource({
|
|||||||
batch: props.batchName,
|
batch: props.batchName,
|
||||||
},
|
},
|
||||||
auto: true,
|
auto: true,
|
||||||
|
onSuccess: (data) => {
|
||||||
|
if (!data) {
|
||||||
|
router.push({ name: 'Batches' })
|
||||||
|
}
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const courses = createResource({
|
const courses = createResource({
|
||||||
|
|||||||
@@ -7,15 +7,10 @@ import zipfile
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import requests
|
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
from frappe.translate import get_all_translations
|
from frappe.translate import get_all_translations
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.query_builder import DocType
|
|
||||||
from frappe.query_builder.functions import Count
|
|
||||||
from frappe.utils import (
|
from frappe.utils import (
|
||||||
time_diff,
|
|
||||||
now_datetime,
|
|
||||||
get_datetime,
|
get_datetime,
|
||||||
cint,
|
cint,
|
||||||
flt,
|
flt,
|
||||||
@@ -24,10 +19,10 @@ from frappe.utils import (
|
|||||||
format_date,
|
format_date,
|
||||||
date_diff,
|
date_diff,
|
||||||
)
|
)
|
||||||
from typing import Optional
|
|
||||||
from lms.lms.utils import get_average_rating, get_lesson_count
|
from lms.lms.utils import get_average_rating, get_lesson_count
|
||||||
from xml.dom.minidom import parseString
|
from xml.dom.minidom import parseString
|
||||||
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
from lms.lms.doctype.course_lesson.course_lesson import save_progress
|
||||||
|
from frappe.core.doctype.communication.email import make
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
@@ -845,7 +840,7 @@ def update_course_statistics():
|
|||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_announcements(batch):
|
def get_announcements(batch):
|
||||||
return frappe.get_all(
|
communications = frappe.get_all(
|
||||||
"Communication",
|
"Communication",
|
||||||
filters={
|
filters={
|
||||||
"reference_doctype": "LMS Batch",
|
"reference_doctype": "LMS Batch",
|
||||||
@@ -863,6 +858,13 @@ def get_announcements(batch):
|
|||||||
order_by="communication_date desc",
|
order_by="communication_date desc",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for communication in communications:
|
||||||
|
communication.image = frappe.get_cached_value(
|
||||||
|
"User", communication.sender, "user_image"
|
||||||
|
)
|
||||||
|
|
||||||
|
return communications
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def delete_course(course):
|
def delete_course(course):
|
||||||
@@ -1225,16 +1227,3 @@ def get_notifications(filters):
|
|||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def is_guest_allowed():
|
def is_guest_allowed():
|
||||||
return frappe.get_cached_value("LMS Settings", None, "allow_guest_access")
|
return frappe.get_cached_value("LMS Settings", None, "allow_guest_access")
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
|
||||||
def make_announcement(students, cc, subject, content):
|
|
||||||
for student in students:
|
|
||||||
frappe.sendmail(
|
|
||||||
recipients=student,
|
|
||||||
cc=cc,
|
|
||||||
subject=subject,
|
|
||||||
message=content,
|
|
||||||
header=[subject, "green"],
|
|
||||||
retry=3,
|
|
||||||
)
|
|
||||||
|
|||||||
@@ -76,17 +76,19 @@ def send_confirmation_email(doc):
|
|||||||
|
|
||||||
|
|
||||||
def send_mail(doc):
|
def send_mail(doc):
|
||||||
subject = _("Enrollment Confirmation for the Next Training Batch")
|
|
||||||
template = "batch_confirmation"
|
|
||||||
custom_template = frappe.db.get_single_value(
|
|
||||||
"LMS Settings", "batch_confirmation_template"
|
|
||||||
)
|
|
||||||
batch = frappe.db.get_value(
|
batch = frappe.db.get_value(
|
||||||
"LMS Batch",
|
"LMS Batch",
|
||||||
doc.batch,
|
doc.batch,
|
||||||
["name", "title", "start_date", "start_time", "medium"],
|
["name", "title", "start_date", "start_time", "medium"],
|
||||||
as_dict=1,
|
as_dict=1,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
subject = _("Enrollment Confirmation for {0}").format(batch.title)
|
||||||
|
template = "batch_confirmation"
|
||||||
|
custom_template = frappe.db.get_single_value(
|
||||||
|
"LMS Settings", "batch_confirmation_template"
|
||||||
|
)
|
||||||
|
|
||||||
args = {
|
args = {
|
||||||
"title": batch.title,
|
"title": batch.title,
|
||||||
"student_name": doc.member_name,
|
"student_name": doc.member_name,
|
||||||
@@ -107,6 +109,6 @@ def send_mail(doc):
|
|||||||
template=template if not custom_template else None,
|
template=template if not custom_template else None,
|
||||||
content=content if custom_template else None,
|
content=content if custom_template else None,
|
||||||
args=args,
|
args=args,
|
||||||
header=[subject, "green"],
|
header=[_(batch.title), "green"],
|
||||||
retry=3,
|
retry=3,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1194,6 +1194,9 @@ def get_neighbour_lesson(course, chapter, lesson):
|
|||||||
|
|
||||||
@frappe.whitelist(allow_guest=True)
|
@frappe.whitelist(allow_guest=True)
|
||||||
def get_batch_details(batch):
|
def get_batch_details(batch):
|
||||||
|
if not frappe.db.get_value("LMS Batch", batch, "published") and has_student_role():
|
||||||
|
return
|
||||||
|
|
||||||
batch_details = frappe.db.get_value(
|
batch_details = frappe.db.get_value(
|
||||||
"LMS Batch",
|
"LMS Batch",
|
||||||
batch,
|
batch,
|
||||||
@@ -1450,7 +1453,7 @@ def get_batch_students(batch):
|
|||||||
)
|
)
|
||||||
detail.assessments[title] = assessment_info
|
detail.assessments[title] = assessment_info
|
||||||
|
|
||||||
if assessment_info.result == "Passed":
|
if assessment_info.result == "Pass":
|
||||||
assessments_completed += 1
|
assessments_completed += 1
|
||||||
|
|
||||||
detail.courses_completed = courses_completed
|
detail.courses_completed = courses_completed
|
||||||
@@ -1493,20 +1496,26 @@ def has_submitted_assessment(assessment, assessment_type, member=None):
|
|||||||
|
|
||||||
attempt = frappe.db.exists(doctype, filters)
|
attempt = frappe.db.exists(doctype, filters)
|
||||||
if attempt:
|
if attempt:
|
||||||
attempt_details = frappe.db.get_value(doctype, filters, fields)
|
fields.append("name")
|
||||||
|
attempt_details = frappe.db.get_value(doctype, filters, fields, as_dict=1)
|
||||||
if assessment_type == "LMS Quiz":
|
if assessment_type == "LMS Quiz":
|
||||||
result = "Failed"
|
result = "Failed"
|
||||||
passing_percentage = frappe.db.get_value(
|
passing_percentage = frappe.db.get_value(
|
||||||
"LMS Quiz", assessment, "passing_percentage"
|
"LMS Quiz", assessment, "passing_percentage"
|
||||||
)
|
)
|
||||||
if attempt_details >= passing_percentage:
|
if attempt_details.percentage >= passing_percentage:
|
||||||
result = "Passed"
|
result = "Pass"
|
||||||
else:
|
else:
|
||||||
result = attempt_details
|
result = attempt_details.status
|
||||||
return frappe._dict(
|
return frappe._dict(
|
||||||
{
|
{
|
||||||
"status": attempt_details,
|
"status": attempt_details.percentage
|
||||||
|
if assessment_type == "LMS Quiz"
|
||||||
|
else attempt_details.status,
|
||||||
"result": result,
|
"result": result,
|
||||||
|
"assessment": assessment,
|
||||||
|
"type": assessment_type,
|
||||||
|
"submission": attempt_details.name,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -6,12 +6,6 @@
|
|||||||
{{ _("We are pleased to inform you that you have been enrolled in our upcoming batch. Congratulations!") }}
|
{{ _("We are pleased to inform you that you have been enrolled in our upcoming batch. Congratulations!") }}
|
||||||
</p>
|
</p>
|
||||||
<br>
|
<br>
|
||||||
<p>
|
|
||||||
<b>
|
|
||||||
{{ title }}
|
|
||||||
</b>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<b>{{ _("Batch Start Date:") }}</b> {{ frappe.utils.format_date(start_date, "medium") }}
|
<b>{{ _("Batch Start Date:") }}</b> {{ frappe.utils.format_date(start_date, "medium") }}
|
||||||
@@ -27,7 +21,7 @@
|
|||||||
<br>
|
<br>
|
||||||
<p>
|
<p>
|
||||||
{{ _("Visit the following link to view your ") }}
|
{{ _("Visit the following link to view your ") }}
|
||||||
<a href="/batches/{{ name }}">{{ _("Batch Details") }}</a>
|
<a href="/lms/batches/{{ name }}">{{ _("Batch Details") }}</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
{{ _("If you have any questions or require assistance, feel free to contact us.") }}
|
{{ _("If you have any questions or require assistance, feel free to contact us.") }}
|
||||||
|
|||||||
@@ -1,18 +1,24 @@
|
|||||||
<div>
|
<div>
|
||||||
<p>{{ _('Hi') }} {{ billing_name }},</p>
|
<p>{{ _('Hi') }} {{ billing_name }},</p>
|
||||||
|
<br>
|
||||||
<p>{{ _('We noticed that you started enrolling in the') }} {{ type }} {{ title }} {{ _('but didn’t complete your payment') }}.</p>
|
<p>{{ _('We noticed that you started enrolling in the') }} {{ type }} {{ title }} {{ _('but didn’t complete your payment') }}.</p>
|
||||||
|
<br>
|
||||||
<p>
|
<p>
|
||||||
{{ _("We have a limited number of seats, and they won't be available for long!")}}
|
{{ _("We have a limited number of seats, and they won't be available for long!")}}
|
||||||
</p>
|
</p>
|
||||||
|
<br>
|
||||||
<p>
|
<p>
|
||||||
{{ _("Don’t miss this opportunity to enhance your skills. Click below to complete your enrollment") }}:
|
{{ _("Don’t miss this opportunity to enhance your skills. Click below to complete your enrollment") }}:
|
||||||
</p>
|
</p>
|
||||||
|
<br>
|
||||||
<p>
|
<p>
|
||||||
<a href="{{ link }}">👉 Complete Your Enrollment</a>
|
<a href="{{ link }}">👉 {{ _("Complete Your Enrollment") }}</a>
|
||||||
</p>
|
</p>
|
||||||
|
<br>
|
||||||
<p>
|
<p>
|
||||||
{{ _("If you have any questions or need assistance, feel free to reach out to our support team.") }}
|
{{ _("If you have any questions or need assistance, feel free to reach out to our support team.") }}
|
||||||
</p>
|
</p>
|
||||||
|
<br>
|
||||||
<p>
|
<p>
|
||||||
{{ __("Looking forward to seeing you enrolled!") }}
|
{{ __("Looking forward to seeing you enrolled!") }}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user