Skip to content

Conversation

@jiminkim214
Copy link
Contributor

Summary

This pull request is the first step towards implementing the backend for the quiz system. It provides random question delivery, shuffling within a challenge, single-attempt enforcement and integration with the challenge points/completion logic.

  • designed prisma schema with different models
  • defined DTOs to structure quiz content delivery, answer submission and progress tracking
  • implemented service logic (selecting unanswered questions, validating and recording answers, calculating points, and updating user scores)
  • built websocket gateway to enable real-time quiz interaction
  • configured quiz module with prisma integration and cross module connections

Remaining TODOs:

  • implement quiz frontend

Depends on #{number of PR}

Test Plan

  • create E2E tests
  • create a quiz and check for any edges cases/features are all working as intended

Notes

Breaking Changes

  • Database schema change

@CLAassistant
Copy link

CLAassistant commented Oct 23, 2025

CLA assistant check
All committers have signed the CLA.

@dti-github-bot
Copy link
Member

dti-github-bot commented Oct 24, 2025

[diff-counting] Significant lines: 757.

Copy link
Contributor

@ambers7 ambers7 left a comment

Choose a reason for hiding this comment

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

Good job with the quiz backend Jimin! It looks like you also included the longDescription for journey changes (from your last PR) in this PR as well, you might want to remove them from this PR or add that into your description of the PR.

Inside quiz.service.ts, you can also combine getRandomQuestion and shuffleQuestion since they both return a random question and the only difference is if you want to exclude a specific question (which is already optional in shuffleQuestion. I also noticed a few other small things I'll add separate comments for.

},
});

if (availableQuestions.length === 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should throw an exception, since you have no questions left to give. Above in getRandomQuestion, you do this:
if (availableQuestions.length === 0) {
throw new NotFoundException('No available questions for this challenge');
}

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.

6 participants