Skip to content

Commit

Permalink
event stats view
Browse files Browse the repository at this point in the history
  • Loading branch information
techpixel committed Apr 28, 2024
1 parent 8ec42f6 commit f27648b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/views/stats.ts
Expand Up @@ -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",
Expand All @@ -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,
Expand Down

0 comments on commit f27648b

Please sign in to comment.