Skip to content

Conversation

@jiminkim214
Copy link
Contributor

@jiminkim214 jiminkim214 commented Dec 5, 2025

Summary

This PR implements quiz feature with backend integration, real-time score updates, and separate tracking for standalone challenges and journeys. It also adds a complete quiz system allowing users to answer trivia questions for bonus points (+10 per correct answer) with shuffle capabilities, confetti celebrations, and integrated score tracking across the app.

Features Added

Frontend

  • Interactive quiz page with category tags, answer selection, and 3 shuffles per question
  • Confettis for correct answers with "+10 PTS"
  • Per-challenge point tracking via QuizModel._pointsByChallenge Map
  • Quiz bonus display in Challenge Completed page (separate for single challenges vs journey totals)
  • Refactored navigation: extracted ArrivalDialog from gameplay_map.dart for conditional flows
  • Scrollable journey view with progress bar showing completion status

Backend

  • WebSocket handlers: requestQuizQuestion, shuffleQuizQuestion, submitQuizAnswer, getQuizProgress
  • Automatic user score increment (+10 per correct answer)
  • 3 new database tables: QuizQuestion, QuizAnswer, UserQuizAnswer with category field
  • Quiz progress tracking per challenge with answered-question filtering

Real-time Updates

  • Leaderboard updates via updateLeaderPosition event
  • Profile score sync via updateUserData event
  • Quiz points automatically included in total calculations

Remaining TODOs:

  • Remove back arrow button from AppBar: After completing a quiz and navigating to Challenge Completed page, the back arrow should not appear
  • Make quiz result dialog non-dismissible by tapping outside: Currently tapping outside the "Correct!"/"Sorry..." dialog dismisses it and returns to quiz page - should require clicking the X or Results button

Depends on #{283} Quiz Frontend and Unit Testing
Depends on #{278} Quiz Backend

Test Plan

Screen.Recording.2025-11-29.at.8.59.52.PM.mov
Screen.Recording.2025-11-29.at.9.03.11.PM.mov

Notes: Simulator Tests for single challenge and journeys (multiple challenges)

Breaking Changes

  • Database schema change

@dti-github-bot
Copy link
Member

dti-github-bot commented Dec 5, 2025

[diff-counting] Significant lines: 3537. This diff might be too big! Developer leads are invited to review the code.

Copy link
Contributor

@jjasonguo jjasonguo left a comment

Choose a reason for hiding this comment

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

Look good and make sense. Frontend designed nicely. Take a look at the line you uncommented and make sure that should be uncommented. E2E tests not passing on my end but it could be a me issue. @3TTemi check it out?


// Note: Uncomment if you want to log all events (gets pretty spammy)
// print(ev);
print(ev);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we want to keep this uncommented?

@@unique([userId, questionId]) // Enforce one attempt per question
@@map("UserQuizAnswer")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

good work!

}
}

/// Reusable button row widget for arrival dialog
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

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.

5 participants