jigarius / toggl2redmine

Import time from Toggl 2 Redmine.
GNU General Public License v3.0
26 stars 6 forks source link

Difference between Toggl and Redmine total time #59

Closed kporras07 closed 3 years ago

kporras07 commented 3 years ago

Bug summary When there are multiple entries in Toggl with some seconds here and there, the totals between Redmine and Toggl don't match because of seconds leftovers.

To Reproduce Steps to reproduce the behavior:

  1. Have several entries in Toggl with some seconds:
    • # 1 Description 1: 0:01:36
    • # 1 Description 2: 0:01:16
    • # 1 Description 3: 0:02:26
    • # 1 Description 4: 0:03:13
  2. Import time into Redmine
  3. Compare totals between Redmine and Toggl. If seconds differences are enough, you should have some minutes differences.
    • Toggl: 8.52 min (0.14h)
    • Redmine: 7 min (0.10h)

Expected behavior Not sure.

Additional context I was looking into the code to try to add rounding option for 1 minute, then I found that L1741 in assets/javascripts/t2r.js is using "imprecise" to remove leftovers seconds.

2 possible changes with this:

Please let me know your thoughts on this. I would like to collaborate with a fix for this if that makes sense to you

jigarius commented 3 years ago

Thank you for reporting the issue. I'll take a look at it as soon as I have time.

jigarius commented 3 years ago

I think I should finally have some time to get this fixed. Here is some more info I could use:

If I can have this info tomorrow, I'll try to work on it tomorrow night. Thanks 👍🏽

kporras07 commented 3 years ago

@jigarius description updated with details. Thanks for looking into this

jigarius commented 3 years ago

Findings

Constraints

Proposed solution

Update default rounding

The thing that can be fixed is the first entry, i.e. if a time entry on Toggl has more than 30s, T2R can round it up to the next minute. Example:

I'll try to get this done as soon as possible.

Use duration rounding

There is already an option to alter the rounding behavior, which I think might help you. In the Advanced options of Toggl 2 Redmine,

jigarius commented 3 years ago

@kporras07 please try out the branch associated with https://github.com/jigarius/toggl2redmine/pull/69 and let me know if it works for you.

Note to self: Gotta redo the JS someday so that it can be tested. Or maybe create a plugin that doesn't rely on Toggl.

kporras07 commented 3 years ago

It works as expected. Thanks :)

jigarius commented 3 years ago

@kporras07 inspired by this issue, I rewrote most of the JavaScript. The good news is that the duration rounding mechanism is now unit-tested. If you have time, please feel free to test ~Toggl 2 Redmine v5.0.0~ Toggl 2 Redmine v4.4.0.

kporras07 commented 3 years ago

Hi @jigarius sure! Is it https://github.com/jigarius/toggl2redmine/releases/tag/v4.4.0-beta.1 the right tag? I can't find the one you linked

jigarius commented 3 years ago

Yes. That is the right tag. I had to remove the other one.

kporras07 commented 3 years ago

I did some basic testing including rounding time entries and everything seems to be working. Do you want me to test something specific or is this enough?

As usual, thanks for all of the work in this great plugin!

jigarius commented 3 years ago

Nothing specific. If everything works normally as earlier, that should suffice. I basically moved things around and used Typescript to do the JavaScript stuff.