feat: decouple SM-2 algorithm, add timezone handling, and unit tests … - #1527
feat: decouple SM-2 algorithm, add timezone handling, and unit tests …#1527Dev1822 wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 3 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Comment |
📝 Pull Request Description
Related Issue
Closes #1524
Summary
Extracted the
calculateSM2spaced repetition logic out of the flashcard controller and into a dedicated utility service (utils/srsAlgorithm.js). Introduced an optionaltimezoneparameter to the algorithm sonextDueDatecan accurately align with the start of the day (midnight) in the user's local timezone, rather than relying strictly on absolute server time. Finally, added a comprehensive Vitest unit testing suite to validate all repetition edge cases and timezone offsets.Type of Change
How Has This Been Tested?
again/hard/medium/easyrating boundaries, ease factor minimums, and timezone parsing (America/New_York,Australia/Sydney, etc.).npm run test/vitest) confirming 100% pass rate for the new algorithm logic.Screenshots (if applicable)
N/A - Backend logic and unit test refactor only.
Checklist