fix: auto-recalculate playability on benchmark submit and sync, fix anti-cheat logic for games without anti-cheat
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user