Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

fix: same challenge being suggested again (#1317)

Fahad3686bde6b50a
diff --git a/apps/web/src/utils/server/get-similar-challenges.ts b/apps/web/src/utils/server/get-similar-challenges.ts
index 5ec090e1..9223038a 100644
--- a/apps/web/src/utils/server/get-similar-challenges.ts
+++ b/apps/web/src/utils/server/get-similar-challenges.ts
@@ -37,7 +37,7 @@ export async function getSimilarChallenges(
where: {
difficulty,
id: {
- notIn: solvedSolutions.flatMap((solution) => solution.challengeId),
+ notIn: [...solvedSolutions.flatMap((solution) => solution.challengeId), challengeId],
},
},
take: maxChallenges,
@@ -47,7 +47,7 @@ export async function getSimilarChallenges(
const firstUnsolved = await prisma.challenge.findMany({
where: {
id: {
- notIn: solvedSolutions.flatMap((solution) => solution.challengeId),
+ notIn: [...solvedSolutions.flatMap((solution) => solution.challengeId), challengeId],
},
},
take: maxChallenges,