working leantime widget 8

This commit is contained in:
Alma 2025-04-12 12:47:33 +02:00
parent 928de78b13
commit d9208b489d

View File

@ -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) {