Skip to content

Commit

Permalink
Debug options selection
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtan2000 committed Sep 15, 2024
1 parent a4343c0 commit 6555e3d
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions app/(main)/test/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,25 +279,7 @@ const QuizPage: React.FC = () => {
fetchData();
}, [selectedTopics, selectedSkills]);

const calculateScore = () => {
if (!quiz) return;

let score = 0;
quiz.mcqs.forEach((mcq) => {
const selectedOption = selectedOptions[mcq.id];
const correctOption = mcq.options.find((option) => option.isAnswer)?.no;

if (selectedOption === correctOption) {
score++;
}
});

return score;
};

const displayScore = () => {
const score = calculateScore();
const totalQuestions = quiz?.mcqs.length || 0;
setCurrentTestQuestionIndex(currentTestQuestionIndex + 1)
setShowTestScore(true);
setShowTestScoreMessage(`You have completed the class test.`);
Expand Down

0 comments on commit 6555e3d

Please sign in to comment.