fix: auto-recalculate playability on benchmark submit and sync, fix anti-cheat logic for games without anti-cheat
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
} from "@/lib/db/schema"
|
||||
import { eq, sql } from "drizzle-orm"
|
||||
import { requireRole } from "@/lib/auth/guard"
|
||||
import { recalculatePlayability } from "./playability"
|
||||
|
||||
export const performanceSubmitRoutes = new Elysia({ prefix: "/performance" })
|
||||
.get(
|
||||
@@ -119,6 +120,18 @@ export const performanceSubmitRoutes = new Elysia({ prefix: "/performance" })
|
||||
})
|
||||
.returning()
|
||||
|
||||
// Recalculate playability for this game (fire and forget)
|
||||
const [gameVersion] = await db
|
||||
.select({ gameId: gameVersions.gameId })
|
||||
.from(gameVersions)
|
||||
.where(eq(gameVersions.id, body.versionId))
|
||||
.limit(1)
|
||||
if (gameVersion) {
|
||||
recalculatePlayability(gameVersion.gameId).catch((err) =>
|
||||
console.error("Failed to recalculate playability:", err),
|
||||
)
|
||||
}
|
||||
|
||||
set.status = 201
|
||||
return {
|
||||
id: entry.id,
|
||||
|
||||
Reference in New Issue
Block a user