mathisdt / trackworktime

Android app to track your work time via WiFi or location and categorize each recorded intervall by a predefined client/task and a free text.
https://zephyrsoft.org/trackworktime
GNU General Public License v3.0
136 stars 30 forks source link

Reports: Added grouping by task and hint #274

Closed JonaOtto closed 7 months ago

JonaOtto commented 8 months ago

Hello TWT Community,

At work, we recently got new time tracking rules, this way I found your app. I am working tickets within a ticketing system, and have different activities to do for each ticket. I use the tasks for each of these activities, and put the ticket numbers in the hint field (some tickets may be quick to complete, so always adding/removing tasks for all of them was not really an option for me). This is the reason, I thought it would be handy, to have an option to export reports with time sums not only grouped by task alone, but by the combination of the task and the hint of an event. This is my attempt to implement this.

There is a new type TaskAndHint, which is used to hold the task as well as the hint of an event as a Map Key. This then allows using the new time calculation methods, which are pretty similar to the ones of the "times by task" options, respectively. On top of that, there are new radio buttons for these options, and some additions around the CSV generator, to export this new format. It still works with empty hints, which will be handled as empty strings in this case - so everything of the same task without a hint will also be grouped together. I added all four options: the general one, daily, weekly and monthly, for it to be similar to the existing "times per task *" grouping options (I am interested in the daily one mostly). I at least tested it with some test inputs within the android studio emulator, but not on a real device yet.

I tried to keep in-sync with the existing code style, but also I do not have any experience with app-development at all. Let me know what you think of the idea and implementation, or if there is anything I can do better.

Thanks for your work on the app and keeping FOSS apps alive :smile:

Merry Christmas & happy holidays :santa:

JonaOtto commented 7 months ago

Hi, Sorry it took me so long. I added the header and deleted the unlikely if case. I added some tests for the new time calculation additions. There are some new static methods as well, to save some typing/lines. It is asserted, that there are the same keys in the expected and actual map, and that the time values are equal. Let me know if something is missing. Thanks :)

mathisdt commented 7 months ago

Nice, thank you!