Skip to content

Commit

Permalink
Also add list of usernames for sock-board
Browse files Browse the repository at this point in the history
  • Loading branch information
malted committed Feb 20, 2025
1 parent c202847 commit d0c7e27
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,8 @@ app.command("/sock-board", async ({ ack, body, client, logger }) => {
const leaderboardRows = await sql`SELECT
c.id AS clan_id,
c.name AS clan_name,
COALESCE(SUM((project->>'total')::int), 0) AS total_seconds_coded
COALESCE(SUM((project->>'total')::int), 0) AS total_seconds_coded,
jsonb_agg(distinct u.username) AS usernames
FROM
clans c
LEFT JOIN
Expand All @@ -528,9 +529,11 @@ app.command("/sock-board", async ({ ack, body, client, logger }) => {
(
{
clan_name,
usernames,
total_seconds_coded,
}: {
clan_name: string;
usernames: string[];
total_seconds_coded: number;
},
idx: number,
Expand All @@ -544,7 +547,7 @@ app.command("/sock-board", async ({ ack, body, client, logger }) => {
? ":third_place_medal:"
: "";

return `${medal} ${clan_name}: ${(total_seconds_coded / 60 / 60).toFixed(1)} hours`;
return `${medal} ${clan_name}: ${(total_seconds_coded / 60 / 60).toFixed(1)} hours (\`${usernames}\`)`;
},
);

Expand Down

0 comments on commit d0c7e27

Please sign in to comment.