fix: auto-recalculate playability on benchmark submit and sync, fix anti-cheat logic for games without anti-cheat

This commit is contained in:
2026-04-30 21:35:38 +08:00
parent a9f78ef74c
commit fccef57d43
3 changed files with 203 additions and 172 deletions
+13
View File
@@ -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,