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

Difference between Toggl and Redmine total time #59

Closed
kporras07 opened this issue Mar 30, 2021 · 11 comments · Fixed by #69
Closed

Difference between Toggl and Redmine total time #59

kporras07 opened this issue Mar 30, 2021 · 11 comments · Fixed by #69
Assignees
Labels
bug Something isn't working

Comments

@kporras07
Copy link

kporras07 commented Mar 30, 2021

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
  1. Import time into Redmine
  2. 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:

  • Add option to round to 1 minute: the field could be changed to select to add the new option.
  • Would you agree on changing that imprecise to false in case rounding is set to 1 minute?

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

@kporras07 kporras07 added the bug Something isn't working label Mar 30, 2021
@jigarius
Copy link
Owner

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

@jigarius jigarius changed the title Differences between Toggl total time and Redmine total time due to some seconds Difference between Toggl and Redmine total time Jul 21, 2021
@jigarius
Copy link
Owner

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

  • The issue description suggests have several entries in Toggl with some seconds. May I request you to give me a specific number? For example, Create 3 time entries on Toggl with durations 4s, 2s, and 5s.
  • In a similar way, point number 3 could use some actual data (otherwise, I'll have to try to reproduce the bug by trial and error). For example, the time on Toggl should be 11s, but the time on Redmine should be 1m.

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

@jigarius jigarius added the question Further information is requested label Jul 21, 2021
@kporras07
Copy link
Author

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

@jigarius
Copy link
Owner

Findings

  • I logged the exact time that you gave me and here's what I got:
    • 1m 36s is rounded to 1m in Redmine
    • 1m 16s is rounded to 1m in Redmine
    • 2m 26s is rounded to 2m in Redmine
    • 3m 13s is rounded to 3m in Redmine

Constraints

  • Toggl can keeps duration as seconds, while we have to round it to minutes because Redmine can only take hours and minutes.

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:

  • 1m 15s -> 1m
  • 1m 30s -> 2m
  • 1m 35s -> 2m

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,

  • Try setting Duartion rounding to Round up (always go to the next minute) or Round off (round to the next minute if 30s or more).
  • Set the rounding value to 1, i.e. 1 minute.

@jigarius jigarius removed the question Further information is requested label Jul 21, 2021
@jigarius
Copy link
Owner

@kporras07 please try out the branch associated with #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
Copy link
Author

It works as expected. Thanks :)

@jigarius
Copy link
Owner

jigarius commented Sep 4, 2021

@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
Copy link
Author

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
Copy link
Owner

jigarius commented Sep 7, 2021

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

@kporras07
Copy link
Author

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
Copy link
Owner

jigarius commented Sep 7, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants