Add responsive multi-mode quiz practice interface#4
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function startExamMode() { | ||
| resetState(); | ||
| state.mode = "exam"; | ||
| state.currentQuestions = pickRandom(state.questions, 50); | ||
| activateQuiz(); |
There was a problem hiding this comment.
Prevent starting quiz before question data loads
The mode handlers assume the question bank is already populated when the buttons are clicked. Because the buttons are wired up before loadQuestions() resolves, a user on a slow or failed fetch can start a quiz while state.questions is still empty, which renders a blank quiz and yields Infinity when finishExam divides by total (0 questions). Consider disabling the mode buttons until the fetch completes or guard these functions so they wait for the questions to load before copying them into state.currentQuestions.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6904a708f2788320922e0e5eecd66927