diff --git a/client/i18n/locales/english/translations.json b/client/i18n/locales/english/translations.json index 661b27a12db..8c18175010d 100644 --- a/client/i18n/locales/english/translations.json +++ b/client/i18n/locales/english/translations.json @@ -425,6 +425,7 @@ "assignments": "Assignments", "question": "Question", "questions": "Questions", + "answered-mcq": "You have unanswered questions and/or incorrect answers.", "explanation": "Explanation", "solution-link": "Solution Link", "source-code-link": "Source Code Link", diff --git a/client/src/templates/Challenges/generic/show.tsx b/client/src/templates/Challenges/generic/show.tsx index 1fcd66507c0..d883c1adead 100644 --- a/client/src/templates/Challenges/generic/show.tsx +++ b/client/src/templates/Challenges/generic/show.tsx @@ -156,6 +156,9 @@ const ShowGeneric = ({ const [submittedMcqAnswers, setSubmittedMcqAnswers] = useState( questions.map(() => null) ); + + const [hasAnsweredMcqCorrectly, sethasAnsweredMcqCorrectly] = useState(true); + const [showFeedback, setShowFeedback] = useState(false); const showNextCurriculum = useFeature('fcc-10').on; @@ -171,7 +174,6 @@ const ShowGeneric = ({ ); }; - // submit const handleSubmit = () => { const hasCompletedAssignments = assignments.length === 0 || allAssignmentsCompleted; @@ -183,6 +185,12 @@ const ShowGeneric = ({ if (hasCompletedAssignments && mcqCorrect) { openCompletionModal(); } + + if (mcqSolutions.length > selectedMcqOptions.length || !mcqCorrect) { + sethasAnsweredMcqCorrectly(false); + } else { + sethasAnsweredMcqCorrectly(true); + } }; const sceneSubject = new SceneSubject(); @@ -258,6 +266,10 @@ const ShowGeneric = ({ ) : null} + {!hasAnsweredMcqCorrectly && ( +

{t('learn.answered-mcq')}

+ )} +