Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Don't calculate expected points on me page
  • Loading branch information
regalijan committed Nov 17, 2024
1 parent b9b619f commit f8015ae
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions app/routes/me.tsx
Expand Up @@ -56,27 +56,6 @@ export async function loader({ context }: { context: RequestContext }) {
)
.bind(currentUser.id)
.first();

if (etData) {
const now = new Date();
const pointsData = await context.env.D1.prepare(
"SELECT answered_at, approved, day, month, performed_at, reached_minimum_player_count, type, year FROM events WHERE created_by = ? AND month = ? AND year = ?;",
)
.bind(currentUser.id, now.getUTCMonth(), now.getUTCFullYear())
.all();

for (const row of pointsData.results as Record<string, any>[]) {
if (row.performed_at) etData.points += 10;
if (row.type === "gamenight" && row.reached_minimum_player_count)
etData.points += 10;
if (
row.type === "rotw" &&
row.answered_at - row.performed_at >= 86400000
)
etData.points += 10;
if (!row.performed_at && row.day < now.getUTCDate()) etData.points -= 5;
}
}
}

return {
Expand Down

0 comments on commit f8015ae

Please sign in to comment.