timetracker icon indicating copy to clipboard operation
timetracker copied to clipboard

Report grouping

Open manfredu opened this issue 4 years ago • 14 comments

Timetracker is a very useful application, thank you for providing and maintaining it!

I'm using 0.0.69 and for me report grouping does not work as expected. E.g., I want to see daily sums, but still get several lines. Also for weekly sums I sometimes get several entries. Monthly and yearly sums seem to be fine.

Additional question: What is shown in the name colounm? Description ist displayed as * when grouping, shouldn't that happen for name as well?

manfredu avatar Aug 26 '21 08:08 manfredu

Hej! I encounter a similar problem. "reports", "group by daily" -> It displays "ERROR" and then an empty table.

roynico avatar Sep 20 '21 06:09 roynico

Same problem here, in particular the "group by: daily" never does any grouping by day. Depending on the other settings it either gives a list of all entries or it displays "ERROR" (and then I have to reload the whole page to recover).

31SFX4 avatar Sep 28 '21 21:09 31SFX4

Hi

Please test commit 44ff8392da4be24f073c7ede0f8711f9527424ef

mtierltd avatar Sep 29 '21 14:09 mtierltd

@mtierltd is that commit in version 0.0.72? It's still not working in that version.

31SFX4 avatar Oct 01 '21 20:10 31SFX4

Yes. We have done tests with both MariaDB and PostgreSQL and we could not reproduce the issue anymore with 0.0.72.

mtierltd avatar Oct 04 '21 16:10 mtierltd

Hmm, still doesn't work for me. The "daily" option always just returns a list of all individual items, no matter what I chose in the other two fields. For the weekly and monthly I do get (as expected) a single table row for each week/month that sums up all the entries. I'll try to do some more tests and see what exactly is going on, but that may take a while.

31SFX4 avatar Oct 04 '21 17:10 31SFX4

So I had a look at lib/Db/ReportItemMapper.php and I can't really work out where the grouping by day happens. For example, in lines 82-90 you have conditional statements for week, year and month, but not for day, so the "day" grouping goes to the last else statement and effectively does the same as the "none" grouping, i.e. no grouping at all?

31SFX4 avatar Oct 04 '21 17:10 31SFX4

It works when I add between lines 87 and 88:

}elseif ($timegroup == 'day') { $selectFields[]= "DATE(FROM_UNIXTIME(start)) as ftime";

31SFX4 avatar Oct 04 '21 18:10 31SFX4

... there's also a time zone problem that the date or week is shifted by one if I was working between 23:00 and midnight, but that's a separate thing.

31SFX4 avatar Oct 04 '21 18:10 31SFX4

Hi Please try commit 710cd33a335c077ff40f225c7bc4806079c1298f, which is based on your modifications. Addressing the other issue is in progress.

mtierltd avatar Oct 07 '21 07:10 mtierltd

Yes, that commit works for me (I can't test the sqlite and postgres parts, only mysql).

31SFX4 avatar Oct 10 '21 14:10 31SFX4

For me report grouping is working fine now! Thanks!

A small remaining issue is column "Name" which sometimes contains a random value. E.g. when group by "Daily" the sum of the day is correctly displayed as one entry.

manfredu avatar Jan 13 '22 07:01 manfredu

When group by is set to "weekly" or "monthly" sometimes I get more than one entry. Looks like this happens when the content of column name is different. So this seems to be inconsistent with "daily".

manfredu avatar Jan 13 '22 07:01 manfredu

Or maybe the duplicate entries occur when working over midnight and the time entry belongs to more than one week or month...?

manfredu avatar Jan 13 '22 07:01 manfredu