Skip to content
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

[Feature] Resume timer on existing task #56

Open
tomek-szczesny opened this issue Jun 8, 2022 · 6 comments
Open

[Feature] Resume timer on existing task #56

tomek-szczesny opened this issue Jun 8, 2022 · 6 comments

Comments

@tomek-szczesny
Copy link

Hi!
I was looking for a similar tool just now and this one is by far the best I could find. I love it!
However, I'd love to be able to do breaks in my tasks, and pause the timer for that duration.

I thought that perhaps the easiest way to do it is to let the user resume the timer on a given task. Under the hood, I think one more field in json file, like "break_time" (0 by default) could keep track of seconds that should be subtracted from total elapsed time of a given task.
What do you think?

@maxRN
Copy link

maxRN commented Jan 16, 2023

Hi,
a resume timer feature would be highly appreciated!
My suggestion on how to implement this would be the following:

[
  {
    "desc": "something else",
    "workTimes": [
      {
        "start": time1,
        "end": time2
      },
      {
        "start": time1,
        "end": time2
      },
      {
        "start": time1,
        "end": time2
      }
    ]
  }
]

I would be down to try and implement this if you think this is a valid approach

@tomek-szczesny
Copy link
Author

The approach that I suggested would not break backward compatibility, with only one field added (that may safely default to 0 if not present).
Otherwise one would have to implement format conversion as well, so the user files won't become useless after update.

@caarlos0
Copy link
Owner

feel free to take a swing at it, yes

@maxRN
Copy link

maxRN commented Jan 16, 2023

The approach that I suggested would not break backward compatibility, with only one field added (that may safely default to 0 if not present).

Otherwise one would have to implement format conversion as well, so the user files won't become useless after update.

Ah, of course you're right I totally missed that!

I'm having a little trouble understanding your proposed solution, though:
If I understand correctly: when we resume a task we take the delta between the current time and the end time and add this duration (in seconds) to the breakTime. And when we pause the task again we just update the end time and the new total is now the delta between end and start time, minus the breakTime in seconds?

@tomek-szczesny
Copy link
Author

That is exactly what I had in mind. Sounds even better after you explained it back to me. :)

@jugglingjsons
Copy link

jugglingjsons commented Dec 27, 2023

Resurrecting the thread, if anyone is interested in pursuing it a little further - there's a working version with task restarter here #127

Caution

Will work only on new projects, I haven't tested it with any old ones. As it changed the base structure of entities. Some exporters may not work either, but the report I use works fine.

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

No branches or pull requests

4 participants