Skip to content

Commit

Permalink
add admin helper
Browse files Browse the repository at this point in the history
  • Loading branch information
techpixel committed Apr 28, 2024
1 parent 01a4bad commit e647928
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/subroutines/events/powerHour.ts
Expand Up @@ -147,6 +147,11 @@ class PowerHour implements BasePicnic {

delete eventSessions[forwardTs];
});

app.command("/_admin_pwrhr_check", async ({ ack, body }) => {
await ack();
await this.hourlyCheck();
});
}

async createSession(slackId: string, messageTs: string): Promise<void> {
Expand Down Expand Up @@ -299,16 +304,16 @@ class PowerHour implements BasePicnic {

const eventContributions = await prisma.eventContributions.findMany({
where: {
eventId: POWERHOUR_ID,
eventId: this.ID,
},
});

const users = await prisma.user.findMany({
where: {
eventId: POWERHOUR_ID,
eventId: this.ID,
},
});

let totalMinutes = 0;
for (const contribution of eventContributions) {
totalMinutes += contribution.minutes;
Expand All @@ -331,12 +336,12 @@ class PowerHour implements BasePicnic {
text: `The community goal of ${this.COMMUNITY_GOAL} minutes was not met. 😢`,
});
}

for (const user of users) {
await prisma.user.update({
where: {
slackId: user.slackId,
eventId: POWERHOUR_ID,
eventId: this.ID,
},
data: {
eventId: "none",
Expand All @@ -347,10 +352,9 @@ class PowerHour implements BasePicnic {
console.log("🎉 PowerHour Event Complete");
}

/*
if (!this.isEventActive()) {
return;
}*/
}

await app.client.chat.postMessage({
channel: Environment.POWERHOUR_ORG,
Expand Down

0 comments on commit e647928

Please sign in to comment.