diff --git a/src/frontend.ts b/src/frontend.ts index c0c783d..303abd1 100644 --- a/src/frontend.ts +++ b/src/frontend.ts @@ -124,7 +124,7 @@ export default function init(router: Router): void { ).then(r => r.json()) as PollResult; if (!poll || poll.error) return res.redirect("/"); const totalVotes = Object.values(poll.votes).reduce((acc, cur) => acc + cur, 0); - const pollOptionsDivs = Object.entries(poll.votes).map(([option, votes]) => ` + const pollOptionsDivs = Object.entries(poll.votes).sort((a, b) => b[1] - a[1]).map(([option, votes]) => `
${ xss(option) }
${ votes }