fixed skip clue implimentation

This commit is contained in:
bobbert committed 2025-03-18 22:25:07 +00:00
1 parent fccc2a4edc
commit 2f9a6c732c
18 files changed
+524 -151

No files matched your search

+5 -4
View File
@@ -43,9 +43,9 @@ export async function GET(request, context) {
return Response.json({ error: "Clue not found" }, { status: 404 });
}
// Check if this team has found this clue before
const found = await queryOne(
"SELECT * FROM team_clues WHERE team_id = ? AND clue_id = ?",
// Check if this team has found or skipped this clue before
const clueStatus = await queryOne(
"SELECT found_at, skipped FROM team_clues WHERE team_id = ? AND clue_id = ?",
[token.teamId, clueId]
);
@@ -66,7 +66,8 @@ export async function GET(request, context) {
return Response.json(
{
...clue,
found: !!found, // Only mark as found if it was previously found
found: !!clueStatus && !(clueStatus.skipped === 1), // Mark as found only if it exists and is not skipped
skipped: !!clueStatus && clueStatus.skipped === 1, // Add skipped status
isAdmin: token.role === "admin", // Add flag so client knows user is admin
},
{ headers: cacheHeaders }