Skip to content

Feature/quiz feedback 704#736

Open
SouparnaChatterjee wants to merge 7 commits into
CircuitVerse:masterfrom
SouparnaChatterjee:feature/quiz-feedback-704
Open

Feature/quiz feedback 704#736
SouparnaChatterjee wants to merge 7 commits into
CircuitVerse:masterfrom
SouparnaChatterjee:feature/quiz-feedback-704

Conversation

@SouparnaChatterjee

@SouparnaChatterjee SouparnaChatterjee commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Feature/quiz-feedback-704
Enhance Pop Quiz Feedback: Correct/Incorrect Messages, Explanations & Try Again (#704)

Fixes #704

Changes done:

  • Added congratulatory messages for correct answers with explanations
  • Added hints for incorrect answers
  • Implemented "Try Again" button to reset quiz selection
  • Added animations for correct/incorrect selections
  • Supported both light and dark themes
  • Disabled other options after selection

Screenshots / Demo

Before:
Screenshot 2025-11-19 201817

After:
https://github.com/user-attachments/assets/c94b39dc-228f-494d-b56c-4939331fafe7

Summary by CodeRabbit

Release Notes

  • New Features

    • Added interactive quiz feedback display with visual indicators for correct and incorrect answers
    • Introduced quiz reset functionality to clear selections and restart
    • Implemented smooth animations for feedback blocks
  • Style

    • Added dark mode support for quiz feedback styling

- Add congratulatory messages for correct answers with explanations
- Add hints for incorrect answers
- Implement Try Again button to reset quiz
- Add animations for correct/incorrect selections
- Support both light and dark themes
- Disable other options after selection

Closes CircuitVerse#704
@coderabbitai

coderabbitai Bot commented Nov 19, 2025

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 516e7f40-1199-4e20-9e35-dadf6f0505c0

📥 Commits

Reviewing files that changed from the base of the PR and between eec1cc3 and 1be8e03.

📒 Files selected for processing (2)
  • _sass/quiz-feedback.scss
  • assets/js/quiz.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • _sass/quiz-feedback.scss
  • assets/js/quiz.js

Walkthrough

This pull request implements a quiz feedback system that delivers immediate, interactive responses to student answers. It introduces a new SCSS partial with feedback block styling, animation states, and dark-mode support. The JavaScript logic extracts correct and incorrect answers alongside explanation text from the HTML markup, renders them with sanitized feedback data attributes, and handles answer clicks via event delegation. When a user selects an answer, the system displays a feedback block indicating correctness, shows the associated explanation or hint, disables further responses, and provides a "Try Again" button to reset the question.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Feature/quiz feedback 704' directly references the feature branch and linked issue #704, clearly indicating the primary change is implementing quiz feedback enhancements.
Linked Issues check ✅ Passed All coding requirements from issue #704 are met: correct answer feedback with explanations [_sass/quiz-feedback.scss, assets/js/quiz.js], incorrect answer hints [assets/js/quiz.js], try-again reset button [assets/js/quiz.js, _sass/quiz-feedback.scss], animations [_sass/quiz-feedback.scss], dark mode support [_sass/quiz-feedback.scss], and disabled other options [assets/js/quiz.js].
Out of Scope Changes check ✅ Passed All changes are directly related to quiz feedback enhancement: new SCSS styling file for feedback UI, JavaScript modifications for feedback logic, and SCSS imports. No unrelated modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (4)
README.md (1)

197-198: Copyright year bump looks good

The update to 2025 is consistent with the rest of the PR; no issues from a code/doc standpoint. As a follow‑up (not blocking), you may want to later extend the “Pop Quizzes” section above to mention the new per‑answer explanations/hints format so authors know how to provide them.

_sass/quiz-feedback.scss (1)

5-33: Answered/disabled answer states and correctness styling align with JS behavior

The .answered and .quiz-disabled rules correctly reinforce the JS logic (no re‑selection, dimmed alternatives, clear correct/incorrect highlighting). There is a small overlap between .quiz-question.answered .quiz-answer and .quiz-answer.quiz-disabled opacity handling, but it’s benign; you can keep it as‑is or consolidate later for tidiness.

assets/js/quiz.js (2)

83-149: ShowQuizAnswer flow matches the new UX (lock answers, show feedback, allow retry)

The event-based ShowQuizAnswer correctly locks the question after one selection, visually distinguishes the chosen answer, disables the rest, and displays either an explanation or hint plus a “Try Again” button, then scrolls to the feedback. The use of scrollIntoView with smooth behavior is a reasonable enhancement; if it’s unsupported the feedback still appears, so there’s no functional blocker here.


151-172: ResetQuiz and escapeHtml utilities are appropriate and align with the new flow

ResetQuiz cleanly restores the question to its initial state (removing answered/disabled/show‑answer classes and clearing feedback), which pairs well with the “Try Again” button, and escapeHtml is correctly implemented for the characters relevant to your feedback/answer text. Once you escape the answer text when rendering options, this helper will fully centralize your safety guarantees.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6a01b5d and cb6b6e8.

📒 Files selected for processing (6)
  • README.md (1 hunks)
  • _sass/quiz-feedback.scss (1 hunks)
  • about.md (1 hunks)
  • assets/css/just-the-docs-circuitverse.scss (1 hunks)
  • assets/css/just-the-docs-circuitversedark.scss (1 hunks)
  • assets/js/quiz.js (3 hunks)
🔇 Additional comments (6)
about.md (1)

10-10: About page copyright year update is correct

The 2025 copyright line aligns with README and the project state; no additional changes needed here.

assets/css/just-the-docs-circuitversedark.scss (1)

7-9: Dark theme import order for quiz feedback looks correct

Adding @import "quiz-feedback"; at the end ensures the new quiz feedback styles (including dark‑mode overrides) are available and can override earlier rules where needed. No issues here.

assets/css/just-the-docs-circuitverse.scss (1)

3-5: Quiz feedback styles correctly wired into light theme

Importing quiz-feedback at the end of the light theme stylesheet is appropriate and keeps feedback visuals consistent with the dark theme integration.

_sass/quiz-feedback.scss (2)

34-129: Animations, feedback box, and reset button styles are cohesive

The pulse/shake and fade‑in animations, feedback box styling, and reset button states form a clear, consistent feedback UI. Focus styles are left to browser defaults, which keeps keyboard accessibility intact; no blocking issues here.


131-158: Dark‑mode overrides correctly target feedback and answer states

The body.dark-mode overrides for feedback boxes and shown correct/incorrect answers map cleanly to the classes used in the JS and should preserve contrast on dark backgrounds. This integration looks sound.

assets/js/quiz.js (1)

65-80: No legacy ShowQuizAnswer calls found—event binding migration is complete

Verification confirms the transition was done correctly. The function is defined with signature ShowQuizAnswer(event) at line 83, extracting the element via event.currentTarget. The only reference in the entire codebase is the proper event binding at line 79 via $('.quiz-answer').on('click', ShowQuizAnswer). No direct calls with element arguments remain.

Comment thread assets/js/quiz.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
_sass/quiz-feedback.scss (1)

87-99: Consider a reduced-motion fallback for animation accessibility.

Nice animation touch, but users with reduced-motion preferences should get a non-animated experience.

♿ Suggested enhancement
 `@keyframes` incorrect-shake {
@@
 }
+
+@media (prefers-reduced-motion: reduce) {
+  .feedback-correct,
+  .feedback-incorrect {
+    animation: none;
+  }
+}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb8b0374-e839-4b80-95df-688e498fcc52

📥 Commits

Reviewing files that changed from the base of the PR and between d42f91c and eec1cc3.

📒 Files selected for processing (1)
  • _sass/quiz-feedback.scss

Comment thread _sass/quiz-feedback.scss Outdated

@magic-peach magic-peach left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core feedback logic is good — disable-on-answer, show correct answer on wrong selection, Try Again reset, dark mode support all work as intended.

Two things to fix before merge:

  1. The README.md change (removing a trailing newline) is unrelated to this PR. Please revert it — it makes the diff noisy and can conflict with other PRs touching that file.

  2. Correct answers will now always render before incorrect ones because ol (correct) is processed before ul (incorrect). On every quiz in the book the right answer will visually appear at the top of the options list, which makes quizzes trivially easy to game. The original code had the same ordering issue in reverse — worth shuffling the answers array before rendering so option order is randomised.

@Me-Priyank

Copy link
Copy Markdown
Member

@Nihal4777 LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance Pop Quiz Feedback : Add explanation and information

3 participants