Fix sorting

This commit is contained in:
2026-02-02 00:02:35 -07:00
parent fed1dfaa24
commit 7c24b22276

View File

@@ -76,7 +76,7 @@ export async function handler (context: Context, type: number) {
} }
}) })
let mapped: Record<string, {}> = {} let mapped = []
for (const row of completeUserList) { for (const row of completeUserList) {
const savedata = row.saveData ? JSON.parse(row.saveData) : null const savedata = row.saveData ? JSON.parse(row.saveData) : null
if (!savedata) continue if (!savedata) continue
@@ -108,7 +108,8 @@ export async function handler (context: Context, type: number) {
const customIcon = savedata.bird?.customIcon?.selected ?? null const customIcon = savedata.bird?.customIcon?.selected ?? null
mapped[row.id] = { mapped.push({
id: row.id,
username: row.username, username: row.username,
value, value,
icon: savedata.bird?.icon ?? 1, icon: savedata.bird?.icon ?? 1,
@@ -116,7 +117,7 @@ export async function handler (context: Context, type: number) {
birdColor: savedata.settings?.colors?.icon ?? [255, 255, 255], birdColor: savedata.settings?.colors?.icon ?? [255, 255, 255],
overlayColor: savedata.settings?.colors?.overlay ?? [255, 255, 255], overlayColor: savedata.settings?.colors?.overlay ?? [255, 255, 255],
customIcon customIcon
} })
} }
connection0.end() connection0.end()
@@ -125,6 +126,6 @@ export async function handler (context: Context, type: number) {
return jsonResponse({ return jsonResponse({
success: true, success: true,
message: null, message: null,
data: mapped data: mapped.sort((a, b) => b.value - a.value)
}) })
} }