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
@@ -1,6 +1,7 @@
import { db } from "@/lib/db/index"
import { games } from "@/lib/db/schema"
import { eq } from "drizzle-orm"
import { recalculatePlayability } from "@/lib/api/playability"
interface SteamReviewData {
reviewScore: number | null;
@@ -256,6 +257,18 @@ export async function syncSteamGame(
})
.where(eq(games.steamAppId, steamAppId))
// Recalculate playability after sync (fire and forget)
const [game] = await db
.select({ id: games.id })
.from(games)
.where(eq(games.steamAppId, steamAppId))
.limit(1)
if (game) {
recalculatePlayability(game.id).catch((err) =>
console.error("Failed to recalculate playability after sync:", err),
)
}
return { success: true }
} catch (err) {
const errorMsg = err instanceof Error ? err.message : String(err)