mtierltd / timetracker

GNU Affero General Public License v3.0
82 stars 28 forks source link

Weekly grouping in reports and timeline displays wrong week #55

Closed 31SFX4 closed 3 years ago

31SFX4 commented 4 years ago

When I select the weekly grouping in reports and timeline, the week is shown incorrectly. See the attached screenshot. The entries are all from 1 to 6 November, so they should be shown as week 2020-10-26 and 2020-11-02, but they are all shown as the week 2020-10-26.

Also the sum seems to be done over both weeks. For example, entry 5 in the weekly grouping (duration 2:44) is the sum of entries 6 (1:04 on 3 Nov) and 8 (1:40 on 1 Nov) although they are in two different weeks.

weekly-an daily-an2 png

31SFX4 commented 4 years ago

After a bit more testing with more data and some test entries, I think what might happen here is that the summation assumes a week starting with Sunday (i.e. 1.-7. November) but it then shows it as the previous Monday (i.e. 26. Oct.). Entries of today and yesterday (Sun 8 and Mon 9 November) are summed under (Mon) 2 Nov.

So it seems the summation assumes that the week starts on Sunday, but the display assumes it's Monday. Perhaps you can use the setting from the calendar to define when the week starts?

puthre commented 3 years ago

All the time data and all the time aggregation is done in UTC time so any user would get the same report on the same data regardless of their timezone.

31SFX4 commented 3 years ago

@puthre I'm not sure I understand your comment. I am actually on UTC, but there is clearly a problem when entries from Friday, 6 Nov, are summarised under Monday, 26 Oct, i.e. ten days earlier and definitely not in the same week in any timezone.

31SFX4 commented 3 years ago

Even with more entries the same problem occurs. For example, I have three entries for a project on 8 Nov (Sun), 13 Nov (Fri) and 14 Nov (Sat) which are all summed under the week 2020-11-02 (Monday), when they should be split between weeks 2020-11-02 and 2020-11-09.

puthre commented 3 years ago

@smatthie Are you using mysql or posgresql?

31SFX4 commented 3 years ago

@puthre MySQL

31SFX4 commented 3 years ago

Update for version 0.47: The bug is still there, but there's been a change. Now it shows the date for the Monday of the correct week, but still sums up from Sunday to Saturday. I.e. the current week is shown as 11 Jan 2021 (which is Monday this week), but the total time is everything from Sunday, 10 Jan, to today (14 Jan.).

31SFX4 commented 3 years ago

Thank you, looks good! The sums are now correct and they are shown for the correct week. I have done a few tests and have not noticed anything strange, so you can close this. Thanks for your good work!