Don't calculate expected points on me page

This commit is contained in:
Regalijan 2024-11-17 13:32:35 -05:00
parent b9b619f61c
commit f8015aebd3
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -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 {