-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: support 30 min streak offsets (@large-r0dent) #7269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
hi @large-r0dent , thank you for your contribution. Can you remove the useless comments? For example this comment is just repeating the actual code const inputValue = parseFloat( // parse float to support fractional stuffThis comment mentiones an issue but not which issue and does not help understand the code. // 0.0 or 0.5 (assuming we only wanna allow 30 min offsets like in original issue)
if (value < -11 || value > 12 || (value % 1 !== 0 && value % 1 !== 0.5)) {What about const isInvalidHour = value < -11 || value > 12;
const isInvalidMinute = value % 1 !== 0 && value % 1 !== 0.5; //we only support no or thirty minute offsets
if(isInvalidHour || isInvalideMinute) {This comments are just repeating the name of the constants Please check the other comments as well. |
|
Please add |
fehmer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @large-r0dent,
please take a look at my comments. Have you tested your changes with a local development environment?
|
@fehmer @Leonabcd123 sorry, new to oss contribution. will fix + poc test |
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
There was a problem hiding this 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 adds support for 30-minute increments in streak hour offset configuration. Previously, users could only set offsets in whole hour increments; now they can use values like 5.5 to represent 5 hours and 30 minutes.
Key Changes:
- Modified parsing logic to use
parseFloatinstead ofparseIntto handle fractional values - Updated date manipulation to calculate hours and minutes separately from the fractional input
- Enhanced validation to allow values ending in .5 for 30-minute increments
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
frontend/src/ts/modals/streak-hour-offset.ts |
Updated parsing logic to support floats, refactored date manipulation to handle fractional hours, and updated validation and error messages |
frontend/src/html/popups.html |
Added step attribute to allow 0.5 increments in the number input |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| ); | ||
|
|
||
| if (isNaN(value)) { | ||
| Notifications.add("Streak hour offset must be a number", 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we call it Streak hour offset, but previously we've called it Streak time offset. Please be more consistent with the naming.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think i would revert the change to "time" and just keep it "hour" everywhere. Half hours are still hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Miodec :thumbs_up:
| export function show(): void { | ||
| if (!ConnectionState.get()) { | ||
| Notifications.add("You are offline", 0, { | ||
| Notifications.add("You are offline :(", 0, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
revert?
Description
add 30 minute streak offsets as described in #7204
i looked at the backend and i'm pretty sure that no changes are needed there since there's nothing that works with it that wouldn't work with floats.