Skip to content

Commit 49bc575

Browse files
committed
fix: prevent duplicate certification categories
1 parent 4580ab0 commit 49bc575

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

lms/lms/api.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ def get_count_of_certified_members(filters=None):
438438
@frappe.whitelist(allow_guest=True)
439439
def get_certification_categories():
440440
categories = []
441+
seen = set()
441442
docs = frappe.get_all(
442443
"LMS Certificate",
443444
filters={
@@ -448,8 +449,10 @@ def get_certification_categories():
448449

449450
for doc in docs:
450451
category = doc.course_title if doc.course_title else doc.batch_title
451-
if category not in categories:
452-
categories.append({"label": category, "value": category})
452+
if not category or category in seen:
453+
continue
454+
seen.add(category)
455+
categories.append({"label": category, "value": category})
453456
return categories
454457

455458

0 commit comments

Comments
 (0)