noot
Some checks failed
commit-tag / commit-tag-image (map[context:./migrations file:./migrations/Dockerfile name:migrations]) (push) Successful in 16s
commit-tag / commit-tag-image (map[context:./ts file:./ts/Dockerfile name:ts]) (push) Failing after 36s

This commit is contained in:
a 2025-06-14 17:46:37 -05:00
parent d5f3ea5848
commit 6c26594bc6
No known key found for this signature in database
GPG Key ID: 2F22877AA4DFDADB

View File

@ -160,7 +160,7 @@ export async function formGuildLeaderboardMessage(guild_id: string): Promise<Cre
// Sort by contribution // Sort by contribution
members.sort((a, b) => Number(b.contributed) - Number(a.contributed)); members.sort((a, b) => Number(b.contributed) - Number(a.contributed));
const topMembers = members.slice(0, 15); const topMembers = members.slice(0, 10);
// Get guild info from first member (all have same guild info) // Get guild info from first member (all have same guild info)
const guildName = members[0].guild_name; const guildName = members[0].guild_name;
@ -171,21 +171,21 @@ export async function formGuildLeaderboardMessage(guild_id: string): Promise<Cre
// Build the leaderboard with proper alignment // Build the leaderboard with proper alignment
const tw = new TabWriter(2); const tw = new TabWriter(2);
// Add header row // Add header row
tw.add(["#", "Rank", "Player", "XP", "%"]); tw.add(["#", "Rank", "Player", "XP", "%"]);
tw.add(["───", "────────────", "────────────────", "──────────", "──────"]); // Separator line tw.add(["───", "────────────", "────────────────", "──────────", "──────"]); // Separator line
topMembers.forEach((member, index) => { topMembers.forEach((member, index) => {
const position = index + 1; const position = index + 1;
const posStr = position === 1 ? "🥇" : position === 2 ? "🥈" : position === 3 ? "🥉" : `${position}.`; const posStr = position === 1 ? "🥇" : position === 2 ? "🥈" : position === 3 ? "🥉" : `${position}.`;
const rankEmoji = getRankEmoji(member.rank); const rankEmoji = getRankEmoji(member.rank);
const contribution = Number(member.contributed); const contribution = Number(member.contributed);
const percentage = ((contribution / totalXP) * 100).toFixed(1); const percentage = ((contribution / totalXP) * 100).toFixed(1);
// Use formatNumber for consistent formatting // Use formatNumber for consistent formatting
const contribFormatted = contribution >= 10_000 const contribFormatted = contribution >= 10_000
? formatNumber(contribution) ? formatNumber(contribution)
: contribution.toLocaleString(); : contribution.toLocaleString();
tw.add([ tw.add([
@ -212,7 +212,7 @@ export async function formGuildLeaderboardMessage(guild_id: string): Promise<Cre
"```", "```",
leaderboardTable, leaderboardTable,
"```", "```",
`*Showing top 15 of ${members.length} members*` `*Showing top ${Math.min(members.length, 10)} of ${members.length} members*`
].join("\n"); ].join("\n");
return { return {