Skip to content

Commit

Permalink
Fix bug History not Show due to pageSize
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtan2000 committed Oct 7, 2024
1 parent c185633 commit 4b5f099
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
27 changes: 0 additions & 27 deletions app/(main)/quiz/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion components/ResultsTop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function ResultsTopComponent({ onQuestionClick, currentQuestionIn

return (
<div className="card">
<h5>Results for Quiz ID: {specificQuiz.id}</h5>
<h5>My Answers</h5>
<div className="progress-bar-container mb-3">
{progress.map((correct: boolean, index: number) => (
<div key={index} className="progress-bar-segment">
Expand Down
2 changes: 1 addition & 1 deletion service/QuizService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 4b5f099

Please sign in to comment.