Skip to content

Conversation

@ambers7
Copy link
Contributor

@ambers7 ambers7 commented Oct 23, 2025

Summary

This pull request implements the backend of the timer feature for Challenges. Challenges may have timers of certain lengths; if so, then each user completing the challenge has their own timer associated with them and that challenge. The timer should be started once the challenge is started, and the challenge should end once the timer ends.

Timers have milestones, at which warnings are sent to the user (ex. 30 seconds left). They can be extended, and when a timer is extended 25% of the user's score if they were to complete the challenge without a timer is deducted. Timers are found through the challengeId and userId associated with each timer.

  • designed ChallengeTimer schema
  • defined DTOs for starting, extending, completing timers and timer warning
  • implemented timer service (starting/extending/completing timer, scheduling warnings and sending warnings, calculating timer end time and if a timer can be extending)
  • added timer event handlers to ChallengeGateway
  • warning scheduler, sending event notifications of when a challenge is started / when a timer ends to frontend

Remaining TODOs:

  • timer frontend (below tasks also in frontend)
  • handle challenge completion notification once timer ends-> end the challenge
  • handle warning notification -> pop up warning
  • handle challenge starting notification -> start the timer

Test Plan

  • create E2E tests
  • create a challenge with a timer and check that it functions

Breaking Changes

  • Database schema change

@dti-github-bot
Copy link
Member

dti-github-bot commented Oct 23, 2025

[diff-counting] Significant lines: 679.

Copy link
Contributor

@jiminkim214 jiminkim214 left a comment

Choose a reason for hiding this comment

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

This looks very solid! One thing I'm wondering is that we’re currently hardcoding business rules like 5 min extension and 25% point deduction in the service. Could we move those into named constants instead of inlining them? That way we can tweak the values without touching logic and we avoid drift if we update one place and forget another. Overall, amazing job amber!

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.

4 participants