From 66aa9cc1c78663f80e6bb5fddd56a7c77c0135a1 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Thu, 17 Apr 2025 22:00:37 -0600 Subject: [PATCH] fedimbed: format poll option counts --- src/modules/fedimbed.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/modules/fedimbed.js b/src/modules/fedimbed.js index 98f1379..8c04a38 100644 --- a/src/modules/fedimbed.js +++ b/src/modules/fedimbed.js @@ -103,6 +103,7 @@ const statsFormatter = Intl.NumberFormat("en-US", { notation: "compact", maximumFractionDigits: 1, }); +const numberFormatter = Intl.NumberFormat("en-US"); const domainCache = new Map(); domainCache.set("cohost.org", "cohost"); // no nodeinfo @@ -1516,9 +1517,9 @@ async function processUrl(msg, url, spoiler = false, command = false) { const percent = o.count / poll.total; const bar = Math.round(percent * 32); - return `**${o.name}** (${o.count}, ${Math.round(percent * 100)}%)\n\`${"\u2588".repeat(bar)}${" ".repeat( - 32 - bar - )}\``; + return `**${o.name}** (${numberFormatter.format(o.count)}, ${Math.round( + percent * 100 + )}%)\n\`${"\u2588".repeat(bar)}${" ".repeat(32 - bar)}\``; }) .join("\n\n") + `\n\n${poll.total} votes \u2022 Ends `, });