Skip to content

fix: prevent SPRINTER badge across date gaps - #545

Merged
jagdish-15 merged 1 commit into
codepvg:mainfrom
YashBora21:fix/sprinter-date-gap
Oct 13, 2026
Merged

jagdish-15 merged 1 commit into
codepvg:mainfrom
YashBora21:fix/sprinter-date-gap

Conversation

@YashBora21

Copy link
Copy Markdown
Contributor

Fix SPRINTER badge awarding multi-day progress

SPRINTER compared the last two solved-count snapshots without checking their dates, so +7 solves spread over several days could still earn it.

Now it only awards the badge when the two snapshots are on consecutive calendar days and the increase is 7 or more.

Tests (node --test tests/badges.test.cjs):

  • Consecutive days, +7: earned
  • Consecutive days, +6: locked
  • 5-day gap, +7: locked
  • Single entry: locked

Also checked manually on the local profile page and ran Prettier.

Fixes #544

@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 . before requesting a review.
  • 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.

@jagdish-15 jagdish-15 added type:bug Something isn't working level:intermediate Indicates the difficulty labels Oct 13, 2026
@jagdish-15

Copy link
Copy Markdown
Collaborator

Thanks for adding the test file!

@jagdish-15
jagdish-15 merged commit c112387 into codepvg:main Oct 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Indicates the difficulty type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] SPRINTER badge incorrectly awards multi-day progress as a single-day achievement

2 participants