From 0b29d88bb52a1b18a9e997188672573f614927f2 Mon Sep 17 00:00:00 2001 From: jsun969 Date: Sat, 21 Oct 2023 00:21:22 +0800 Subject: [PATCH] fix: clean up test and question relation by test id --- app/_game/helpers/getQuestions.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/_game/helpers/getQuestions.ts b/app/_game/helpers/getQuestions.ts index 606667c..6e467b4 100644 --- a/app/_game/helpers/getQuestions.ts +++ b/app/_game/helpers/getQuestions.ts @@ -73,9 +73,7 @@ const generateRandomQuestions = async ({ .insert(tests) .values({ id: testId }) .onDuplicateKeyUpdate({ set: { id: testId } }) - await db - .delete(questionsToTests) - .where(inArray(questionsToTests.questionId, randomIds)) + await db.delete(questionsToTests).where(eq(questionsToTests.testId, testId)) await db .insert(questionsToTests) .values(randomIds.map((questionId) => ({ questionId, testId })))