From b9df7023be57732e95eea3a53ad936bc674bf67b Mon Sep 17 00:00:00 2001 From: Horilla Date: Thu, 13 Jun 2024 11:22:36 +0530 Subject: [PATCH] [FIX] Employee: Fixed badge id issue when creating an employee --- employee/methods/methods.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/employee/methods/methods.py b/employee/methods/methods.py index ba9ad68ce..48162dab2 100644 --- a/employee/methods/methods.py +++ b/employee/methods/methods.py @@ -48,7 +48,10 @@ def get_ordered_badge_ids(): # Sort each subgroup alphabetically and numerically for group in grouped_data: group.sort() - group.sort(key=lambda x: int("".join(filter(str.isdigit, x)))) + filtered_group = [ + item for item in group if any(char.isdigit() for char in item) + ] + filtered_group.sort(key=lambda x: int("".join(filter(str.isdigit, x)))) # Create a list containing the first and last items from each group result = [[group[0], group[-1]] for group in grouped_data]