diff --git a/src/components/Course/QuizView.tsx b/src/components/Course/QuizView.tsx index e9f5fec33..a0cc97059 100644 --- a/src/components/Course/QuizView.tsx +++ b/src/components/Course/QuizView.tsx @@ -37,7 +37,7 @@ export function QuizView(props: QuizViewProps) {
-

+

{lesson.frontmatter.title}

@@ -124,23 +124,33 @@ type QuizItemProps = { export function QuizItem(props: QuizItemProps) { const { id, title, options, onOptionSelectChange, disabled } = props; - const hasWrongAnswer = options.some((item) => item.status === 'wrong'); - const hasCorrectAnswer = options.some((item) => item.status === 'correct'); + const isAttempted = options.some((item) => + ['correct', 'wrong'].includes(item.status ?? ''), + ); + const hasWrongAnswer = + isAttempted && options.some((item) => item.status === 'wrong'); + const hasCorrectAnswer = isAttempted && !hasWrongAnswer; + + console.log(options); return (
{(hasWrongAnswer || hasCorrectAnswer) && ( - Correct + {hasCorrectAnswer ? 'Correct' : 'Wrong'} )} @@ -183,10 +193,10 @@ export function QuizOption(props: QuizOptionProps) {