From f27648b9c7797ad1704d9375d4c10623b45a4615 Mon Sep 17 00:00:00 2001 From: techpixel Date: Sun, 28 Apr 2024 13:33:21 -0500 Subject: [PATCH] event stats view --- src/views/stats.ts | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/views/stats.ts b/src/views/stats.ts index 8f86bf6..4e6527c 100644 --- a/src/views/stats.ts +++ b/src/views/stats.ts @@ -27,7 +27,7 @@ export class Views { if (goals.length === 0) { throw new Error(`Goals of ${userId} not found.`); } - + const blocks: KnownBlock[] = goals.map(goal => { return { "type": "section", @@ -49,6 +49,27 @@ export class Views { } }); + // Check if user is in eventContributions + const eventContributions = await prisma.eventContributions.findMany({ + where: { + slackId: userId, + eventId: "powerhour" + } + }); + + if (eventContributions) { + blocks.push({ + "type": "divider" + }); + blocks.push({ + "type": "section", + "text": { + "type": "mrkdwn", + "text": `*Power Hour Contributions*: ${formatHour(eventContributions[0].minutes)+7} hours\n_(${eventContributions[0].minutes} minutes)_` + } + }); + } + return { "type": "modal", "callback_id": Callbacks.STATS,