mtierltd / timetracker

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

Report grouping #142

Open manfredu opened 2 years ago

manfredu commented 2 years ago

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?

roynico commented 2 years ago

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

31SFX4 commented 2 years ago

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).

mtierltd commented 2 years ago

Hi

Please test commit 44ff8392da4be24f073c7ede0f8711f9527424ef

31SFX4 commented 2 years ago

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

mtierltd commented 2 years ago

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

31SFX4 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

It works when I add between lines 87 and 88:

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

31SFX4 commented 2 years ago

... 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.

mtierltd commented 2 years ago

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

31SFX4 commented 2 years ago

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

manfredu commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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