Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Account for approval status in calculated report page
  • Loading branch information
regalijan committed Jul 3, 2024
1 parent 8c9e5d9 commit 4a7d27d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/routes/events-team_.report.tsx
Expand Up @@ -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();
Expand 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;
Expand Down

0 comments on commit 4a7d27d

Please sign in to comment.