Skip to content

Conversation

@large-r0dent
Copy link

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.

@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Dec 18, 2025
@large-r0dent large-r0dent changed the title Support 30 minute streak offsets feat: support 30 min streak offsets (@large-r0dent) Dec 18, 2025
@fehmer
Copy link
Member

fehmer commented Dec 19, 2025

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 stuff

This 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

  const hours = Math.floor(inputValue); // integer part is hour offset
  const minutes = (inputValue % 1) * 60; // fractional part is minutes

Please check the other comments as well.

@fehmer
Copy link
Member

fehmer commented Dec 19, 2025

Copy link
Member

@fehmer fehmer left a 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?

@github-actions github-actions bot added the waiting for update Pull requests or issues that require changes/comments before continuing label Dec 19, 2025
@large-r0dent
Copy link
Author

@fehmer @Leonabcd123 sorry, new to oss contribution. will fix + poc test

@github-actions github-actions bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Dec 19, 2025
@Miodec Miodec requested a review from Copilot December 20, 2025 09:19
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Dec 20, 2025
@github-actions
Copy link
Contributor

Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes.

@github-actions github-actions bot added waiting for update Pull requests or issues that require changes/comments before continuing and removed waiting for review Pull requests that require a review before continuing labels Dec 20, 2025
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 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 parseFloat instead of parseInt to 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>
@github-actions github-actions bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Dec 20, 2025
@Miodec Miodec added the format Ask the bot to fix formatting on this pr label Dec 20, 2025
@github-actions github-actions bot removed the format Ask the bot to fix formatting on this pr label Dec 20, 2025
);

if (isNaN(value)) {
Notifications.add("Streak hour offset must be a number", 0);
Copy link
Contributor

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.

Copy link
Member

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.

Copy link
Author

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, {
Copy link
Member

Choose a reason for hiding this comment

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

revert?

@Miodec Miodec added the waiting for update Pull requests or issues that require changes/comments before continuing label Dec 21, 2025
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 update Pull requests or issues that require changes/comments before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants