From 49bc5750a1439fed2c67579cf875f3cd77fa66bc Mon Sep 17 00:00:00 2001 From: KerollesFathy Date: Mon, 15 Dec 2025 18:30:01 +0000 Subject: [PATCH] fix: prevent duplicate certification categories --- lms/lms/api.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lms/lms/api.py b/lms/lms/api.py index ba24383c..27c14211 100644 --- a/lms/lms/api.py +++ b/lms/lms/api.py @@ -438,6 +438,7 @@ def get_count_of_certified_members(filters=None): @frappe.whitelist(allow_guest=True) def get_certification_categories(): categories = [] + seen = set() docs = frappe.get_all( "LMS Certificate", filters={ @@ -448,8 +449,10 @@ def get_certification_categories(): for doc in docs: category = doc.course_title if doc.course_title else doc.batch_title - if category not in categories: - categories.append({"label": category, "value": category}) + if not category or category in seen: + continue + seen.add(category) + categories.append({"label": category, "value": category}) return categories