diff --git a/src/components/quizzes/QuizViewer.tsx b/src/components/quizzes/QuizViewer.tsx index f348fbe..dec1689 100644 --- a/src/components/quizzes/QuizViewer.tsx +++ b/src/components/quizzes/QuizViewer.tsx @@ -358,16 +358,40 @@ export function QuizViewer({ quiz, retakeIds, isShared = false, onFinished }: Qu {/* Rationale shown after submission */} - {isSubmitted && ( -
-

Rationale

-
+ {isSubmitted && (() => { + const formattedQ = { + id: currentQ.id, + type: currentQ.type as "MULTIPLE_CHOICE" | "SATA", + options: currentQ.options, + }; + const qScore = scoreQuestion(formattedQ, currentSelections); + let badgeText = "Incorrect"; + let badgeColor = "bg-error text-white"; + + if (qScore === 1) { + badgeText = "Correct"; + badgeColor = "bg-success text-white"; + } else if (qScore > 0) { + badgeText = "Partially Correct"; + badgeColor = "bg-amber-500 text-white"; + } + + return ( +
+
+

Rationale

+ + {badgeText} + +
+
{currentQ.rationale}
- )} + ); + })()}
{/* Action bar */}