fix: converted sql to qb

This commit is contained in:
Jannat Patel
2024-04-23 17:52:21 +05:30
parent e6e8718bb4
commit 324ede5523

View File

@@ -4,6 +4,8 @@
import frappe import frappe
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
@frappe.whitelist() @frappe.whitelist()
@@ -329,14 +331,13 @@ def get_evaluator_details(evaluator):
@frappe.whitelist(allow_guest=True) @frappe.whitelist(allow_guest=True)
def get_certified_participants(): def get_certified_participants():
participants = frappe.db.sql( LMSCertificate = DocType("LMS Certificate")
""" participants = (
SELECT DISTINCT lc.member frappe.qb.from_(LMSCertificate)
FROM `tabLMS Certificate` lc .select("DISTINCT member")
WHERE lc.published = 1 .where(LMSCertificate.published == 1)
ORDER BY lc.creation desc .order_by("creation desc")
""", .run()
as_dict=1,
) )
participant_details = [] participant_details = []