Skip to content

Fix negative period delta calculation in sync-leaderboard#249

Open
Abhinav21Chauhan wants to merge 1 commit into
codepvg:mainfrom
Abhinav21Chauhan:fix/negative-leaderboard-score
Open

Fix negative period delta calculation in sync-leaderboard#249
Abhinav21Chauhan wants to merge 1 commit into
codepvg:mainfrom
Abhinav21Chauhan:fix/negative-leaderboard-score

Conversation

@Abhinav21Chauhan

Copy link
Copy Markdown

Description

Linked Issue

Fixes # (issue number)
#238 fixed

Changes Made

Summary

This PR prevents negative period deltas in processTimeframe() by clamping
easySolved, mediumSolved, and hardSolved to a minimum of 0 using
Math.max(0, ...).

Changes

  • Clamp easySolved delta to zero.
  • Clamp mediumSolved delta to zero.
  • Clamp hardSolved delta to zero.

This prevents negative solved counts and negative leaderboard scores when the
current cumulative totals are lower than the previous snapshot.

Type of Change

  • Bug fix
  • New feature
  • UI/Visual update
  • Documentation update
  • Refactor

Testing

  • Tested locally
  • Tested on mobile viewport (if applicable)
  • No console errors introduced

Checklist

  • My code follows the project's coding style
  • I have formatted my code locally by running npx prettier --write . before submitting
  • I am submitting my PR from a dedicated feature/* branch, not the main branch
  • I have performed a self-review of my code
  • My changes generate no new warnings or errors
  • I have updated documentation if required
  • I have linked the relevant issue

Screenshots / Screen Recording

@github-actions

Copy link
Copy Markdown
Contributor

Thank you for submitting a pull request.

Please ensure your changes comply with the project's contribution guidelines and that all workflow checks pass successfully.

Formatting and Branching

  • Please confirm you have formatted your code locally using npx prettier --write ., or you can simply comment /format on this PR to have our bot do it for you!
  • Ensure this PR is made from a feature/* branch and not main.

Note: This project is currently maintained by a solo maintainer, so reviews and responses may sometimes take a little time. Thanks for your patience.

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.

1 participant