From 4a7d27d50c47be761a21eec9acbed5921f2c5056 Mon Sep 17 00:00:00 2001 From: Regalijan Date: Wed, 3 Jul 2024 00:55:02 -0400 Subject: [PATCH] Account for approval status in calculated report page --- app/routes/events-team_.report.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/routes/events-team_.report.tsx b/app/routes/events-team_.report.tsx index 1dbe8c8..da37eae 100644 --- a/app/routes/events-team_.report.tsx +++ b/app/routes/events-team_.report.tsx @@ -38,7 +38,7 @@ export async function loader({ context }: { context: RequestContext }) { "SELECT id, name, roblox_id FROM et_members;", ).all(); const eventsQuery = await context.env.D1.prepare( - "SELECT answered_at, created_by, performed_at, reached_minimum_player_count, type FROM events WHERE month = ? AND year = ?;", + "SELECT approved, answered_at, created_by, performed_at, reached_minimum_player_count, type FROM events WHERE month = ? AND year = ?;", ) .bind(month, year) .all(); @@ -52,13 +52,14 @@ export async function loader({ context }: { context: RequestContext }) { ); for (const event of eventsQuery.results as { + approved: number; answered_at: number; created_by: string; performed_at: number; reached_minimum_player_count: number; type: string; }[]) { - if (!memberMap[event.created_by]) continue; + if (!memberMap[event.created_by] || !event.approved) continue; if (event.performed_at) memberMap[event.created_by].points += 10; else memberMap[event.created_by].points -= 10;