Skip to content

Conversation

@Chaitanya-Keyal
Copy link
Contributor

Description

The current streak hour offset validation fails for values like -5.5 because -5.5 % 1 evaluates to -0.5, causing the fractional check to fail.

This PR simplifies the validation logic by multiplying the value by 2 and checking whether the result is an integer. This correctly allows only whole-hour and half-hour (.5) offsets while handling negative values properly.

Screenshot 2026-01-14 203300

Checks

  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

Closes #7204, related PRs #7269, #7362

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Jan 14, 2026
@Miodec Miodec requested a review from Copilot January 14, 2026 16:49
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Jan 14, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a validation bug in the streak hour offset modal that incorrectly rejected negative half-hour values (e.g., -5.5). The issue occurred because the modulo operation on negative decimal numbers produces negative results (e.g., -5.5 % 1 = -0.5), which the original validation logic didn't handle correctly.

Changes:

  • Simplified validation logic from checking value % 1 !== 0 && value % 1 !== 0.5 to (value * 2) % 1 !== 0
  • Added a clarifying comment explaining the new validation approach

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Miodec Miodec merged commit c31dd1e into monkeytypegame:master Jan 14, 2026
20 checks passed
@Chaitanya-Keyal Chaitanya-Keyal deleted the fix/half-hour-streak-offset branch January 14, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Streak Hour Offset does not allow 30 mins difference

3 participants