feat: certified participants

This commit is contained in:
Jannat Patel
2024-04-23 17:29:16 +05:30
parent 93e42fbd86
commit e6e8718bb4
5 changed files with 105 additions and 2 deletions

View File

@@ -325,3 +325,35 @@ def get_evaluator_details(evaluator):
"calendar": calendar.name,
"is_authorised": calendar.authorization_code,
}
@frappe.whitelist(allow_guest=True)
def get_certified_participants():
participants = frappe.db.sql(
"""
SELECT DISTINCT lc.member
FROM `tabLMS Certificate` lc
WHERE lc.published = 1
ORDER BY lc.creation desc
""",
as_dict=1,
)
participant_details = []
for participant in participants:
details = frappe.db.get_value(
"User",
participant.member,
["name", "full_name", "username", "user_image"],
as_dict=True,
)
course_names = frappe.get_all(
"LMS Certificate", {"member": participant.member}, pluck="course"
)
courses = []
for course in course_names:
courses.append(frappe.db.get_value("LMS Course", course, "title"))
details.courses = courses
participant_details.append(details)
return participant_details

View File

@@ -34,7 +34,7 @@ class LMSLiveClass(Document):
def add_event_participants(self, event, calendar):
participants = frappe.get_all(
"Batch Student", {"parent": self.class_name}, pluck="student"
"Batch Student", {"parent": self.batch_name}, pluck="student"
)
participants.append(frappe.session.user)