From d9208b489dd095bbe3e1b175c5a73433eef6a995 Mon Sep 17 00:00:00 2001 From: Alma Date: Sat, 12 Apr 2025 12:47:33 +0200 Subject: [PATCH] working leantime widget 8 --- app/api/leantime/status-labels/route.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/leantime/status-labels/route.ts b/app/api/leantime/status-labels/route.ts index b00f5780..3354f412 100644 --- a/app/api/leantime/status-labels/route.ts +++ b/app/api/leantime/status-labels/route.ts @@ -123,7 +123,7 @@ export async function GET() { name: label.name, statusType: label.statusType, class: label.class, - sortKey: label.sortKey, + sortKey: Number(label.sortKey) || 0, // Convert to number, default to 0 if invalid projects: [] }); } @@ -134,9 +134,9 @@ export async function GET() { }); }); - // Convert the map to an array and sort by sortKey + // Convert the map to an array and sort by sortKey numerically const transformedLabels = Array.from(uniqueLabels.values()) - .sort((a, b) => (a.sortKey || '').localeCompare(b.sortKey || '')); + .sort((a, b) => a.sortKey - b.sortKey); return NextResponse.json({ statusLabels: transformedLabels }); } catch (error) {