Don't calculate expected points on me page
This commit is contained in:
parent
b9b619f61c
commit
f8015aebd3
@ -56,27 +56,6 @@ export async function loader({ context }: { context: RequestContext }) {
|
|||||||
)
|
)
|
||||||
.bind(currentUser.id)
|
.bind(currentUser.id)
|
||||||
.first();
|
.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 {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user