From 4b5f099bb854a302ec8b074ca86ecfb766c9cbd3 Mon Sep 17 00:00:00 2001 From: andrewtan2000 Date: Mon, 7 Oct 2024 21:11:37 +0800 Subject: [PATCH] Fix bug History not Show due to pageSize --- app/(main)/quiz/page.tsx | 27 --------------------------- components/ResultsTop.tsx | 2 +- service/QuizService.tsx | 2 +- 3 files changed, 2 insertions(+), 29 deletions(-) diff --git a/app/(main)/quiz/page.tsx b/app/(main)/quiz/page.tsx index fd651fd..620d7f9 100644 --- a/app/(main)/quiz/page.tsx +++ b/app/(main)/quiz/page.tsx @@ -291,33 +291,6 @@ const QuizPage: React.FC = () => { setSelectedSkills(newSelectedSkills); }, [selectedTopicNodes]); - useEffect(() => { - const fetchData = async () => { - const retrieveQuestionRequest = { - topics: selectedTopics, - skills: selectedSkills, - pageNumber: 0, - pageSize: 600 - }; - - try { - const mcqResponse = (await QuestionsService.retrieveMCQ(retrieveQuestionRequest)).mcqs; - if (mcqResponse && mcqResponse) { - const uniqueIds = new Set(mcqResponse.map((mcq) => mcq.id)); - const count = uniqueIds.size; - setGeneratedQuestionCount(count); - } else { - setGeneratedQuestionCount(0); - } - } catch (error) { - console.error('Error retrieving MCQs:', error); - setGeneratedQuestionCount(0); - } - }; - - fetchData(); - }, [selectedTopics, selectedSkills]); - const calculateScore = () => { if (!quiz) return; diff --git a/components/ResultsTop.tsx b/components/ResultsTop.tsx index 819b282..7856448 100644 --- a/components/ResultsTop.tsx +++ b/components/ResultsTop.tsx @@ -79,7 +79,7 @@ export default function ResultsTopComponent({ onQuestionClick, currentQuestionIn return (
-
Results for Quiz ID: {specificQuiz.id}
+
My Answers
{progress.map((correct: boolean, index: number) => (
diff --git a/service/QuizService.tsx b/service/QuizService.tsx index ee1d33f..57e0c72 100644 --- a/service/QuizService.tsx +++ b/service/QuizService.tsx @@ -40,7 +40,7 @@ export const QuizService = { console.log('Fetching In Progress Quiz from API...'); const headers = ApiHelper.getRequestHeaders(); const response = await fetch( - `${process.env.NEXT_PUBLIC_QUEMISTRY_QUIZZES_URL}/me/in-progress?pageNumber=0&pageSize=${questionCount}`, + `${process.env.NEXT_PUBLIC_QUEMISTRY_QUIZZES_URL}/me/in-progress?pageNumber=0&pageSize=60`, { headers: headers, credentials: "include"