feat(quiz): allow revealing correct answers on success #487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist:
Update index.md
)This PR:
useQuiz
hook to pass the correct status to the correct answershowCorrectAnswersOnSuccess
prop touseQuiz
Screenshot
At the moment, the Quiz component only shows the validation status (correct or incorrect) on the selected answer. We've got a request that if the user has passed the quiz but got some questions wrong, they should be able to see what the correct answers are.
The validation status is implemented here:
ui/src/quiz/use-quiz.ts
Lines 69 to 81 in 6b83ce3
Instead of just adding a
grade >= passingGrade
conditional, I'm using ashowCorrectAnswersOnSuccess
prop as well. I want to give the component some flexibility but I'm not sure if we really need this prop. Currently we only have quizzes and exams as the consumers:Though, if we just have the
grade >= passingGrade
conditional, the changes in this PR are breaking changes and should go into v4.