🐛 Fixed bug with player sort when one username can be number

This commit is contained in:
Proxyfil
2026-03-20 19:08:07 +01:00
parent a179fa8b75
commit 9f2e882991
3 changed files with 21 additions and 25 deletions
@@ -20,7 +20,14 @@ SPDX-License-Identifier: MPL-2.0
let { scores, custom_field, answers }: Props = $props();
let usernames = Object.keys(scores);
let usernames = $derived(
Object.keys(scores).sort((a, b) => {
const scoreA = parseFloat(scores[a]) || 0;
const scoreB = parseFloat(scores[b]) || 0;
return scoreB - scoreA;
})
);
const correctCounts = {};
answers.forEach((questionAnswers) => {
questionAnswers.forEach((answer) => {