timetrace icon indicating copy to clipboard operation
timetrace copied to clipboard

Ideas for `timetrace report`

Open dominikbraun opened this issue 4 years ago • 26 comments

I'm planning for a timetrace report command which should generate a report of the tracked time. This issue is a small idea collection for the new command.

@FelixTheodor, @rocar, @rknizzle, @aaronsheah, @joshuaherrera, @Gealber, @KonstantinGasser, @adzo261, @obnoxiousnerd, @aligator and @nrobinson2000 should feel free to add their suggestions here!

dominikbraun avatar May 28 '21 12:05 dominikbraun

  • Reports should be exportable as JSON.

dominikbraun avatar May 28 '21 12:05 dominikbraun

  • There should be a --billable flag to generate reports only for billable records.

dominikbraun avatar May 28 '21 12:05 dominikbraun

Does the report needs to follow a specific structure in order to be import it into some other software? If so, providing CSV output might also be useful in addition to JSON, right? timetrace report where the default could be JSON and report can have a csv flag?

KonstantinGasser avatar May 28 '21 12:05 KonstantinGasser

I'd suggest that timetrace report prints a table as usual, and a --output option accepts json and csv as values.

dominikbraun avatar May 28 '21 12:05 dominikbraun

Ok I see. If timetrace start project has not been stopped yet should this ongoing period be ignored in the report or be included? I guess another question would be whether the user defines the output directorty/file or if the report.json/csv will be stored in a ~/.timetrace directory?

KonstantinGasser avatar May 28 '21 12:05 KonstantinGasser

If timetrace start project has not been stopped yet should this ongoing period be ignored in the report or be included? I guess another question would be whether the user defines the output directorty/file or if the report.json/csv will be stored in a ~/.timetrace directory?

Good questions - especially the latter one should be discussed.

dominikbraun avatar May 28 '21 12:05 dominikbraun

Since timetrace provides an interface to its config one other option could be to let the user change the lets say report-dir config field to whatever directory. The default could be in for example the ~/.timetrace/reports directory?

KonstantinGasser avatar May 28 '21 12:05 KonstantinGasser

If timetrace start project has not been stopped yet should this ongoing period be ignored in the report or be included?

I think it would make sense to give an alert about the ongoing tracking and then tell them to stop tracking before creating the report.

retronav avatar May 29 '21 04:05 retronav

I like the idea. I'd imagine we could implement different commands / flags to customize the created report. We could use a --project <key> flag to grab all time logged on a project, or filter the report by time, e.g. a --month <month>, --week <weekNumber> or use a combination of --start and --end flags to get all time tracked for the month or week, or within some time frame, irrespective of project.

Thoughts or concerns?

joshuaherrera avatar May 29 '21 04:05 joshuaherrera

Since timetrace provides an interface to its config one other option could be to let the user change the lets say report-dir config field to whatever directory. The default could be in for example the ~/.timetrace/reports directory?

@KonstantinGasser Yes, we could introduce a config value for that, or an --output/-o flag, or even both.

dominikbraun avatar May 29 '21 05:05 dominikbraun

@dominikbraun I would be happy to implement a first proposal if that's ok.

KonstantinGasser avatar May 29 '21 16:05 KonstantinGasser

@dominikbraun for clarification I have one more question. The generated report is only for one project, right? So the user would call the command with the project name like so report <ProjectKey> and the report would hold all recorded records for this project? Or would report hold a list of all projects with its records?

KonstantinGasser avatar May 30 '21 15:05 KonstantinGasser

@dominikbraun for clarification I have one more question. The generated report is only for one project, right? So the user would call the command with the project name like so report <ProjectKey> and the report would hold all recorded records for this project? Or would report hold a list of all projects with its records?

Both use cases would make sense: Generating a report of all projects I've been working on from date X to date Y, as well as generating a report for a particular project.

Maybe it would be sufficient to generate a report for all projects by default and generate a report for a single project using a --project flag?

dominikbraun avatar May 30 '21 16:05 dominikbraun

Yes I feel this would be intuitive to have the ---project flag and else make a report for all records between the time frame. When it comes to the json output do you have anything special in mind here or would the following json ok? For all project: {key_1: [{},{}], key_2:[{},{}]...} For one project {key: [{},{}]}

KonstantinGasser avatar May 30 '21 16:05 KonstantinGasser

Yes, that should work if I'm not missing something 😄

dominikbraun avatar May 30 '21 16:05 dominikbraun

@dominikbraun I am almost done with this issue I just wanted to cross check the results with you and clarify one question.

When it comes the to output table I included a total time for each project. However, I am not sure whether each record-row in the table needs to display its total. Below I have three tables as an example. (for the project timetest I forgot to stop the tracking that's why it shows such a high total time 😄). I prefer the last table version as it looks more organised and structured - easy to understand

All rows with total
+-----------+---------+-------+------------+---------------+
|  PROJECT  |  START  |  END  |  BILLABLE  |     TOTAL     |
+-----------+---------+-------+------------+---------------+
| test      | 00:37   | 00:37 | no         | 0h 0min 9sec  |
| test      | 00:37   | 00:37 | no         | 0h 0min 9sec  |
| test      | ---     | ---   | ---        | 0h 0min 18sec |
| edittest  | 12:35   | 12:41 | no         | 0h 6min       |
| edittest  | 12:35   | 12:41 | no         | 0h 6min       |
| edittest  | 09:10   | 09:10 | no         | 0h 0min 20sec |
| edittest  | ---     | ---   | ---        | 0h 13min      |
| time      | 14:46   | 15:10 | no         | 0h 23min      |
| time      | 14:46   | 15:10 | no         | 0h 23min      |
| time      | ---     | ---   | ---        | 0h 47min      |
| seconly   | 15:10   | 15:11 | no         | 0h 0min 22sec |
| seconly   | 15:15   | 15:49 | no         | 0h 33min      |
| seconly   | 15:10   | 15:11 | no         | 0h 0min 22sec |
| seconly   | 15:15   | 15:49 | no         | 0h 33min      |
| seconly   | ---     | ---   | ---        | 1h 8min       |
| timetest  | 15:52   | 15:53 | no         | 0h 1min       |
| timetest  | 16:00   | 15:55 | no         | 23h 54min     |
| timetest  | 15:52   | 15:53 | no         | 0h 1min       |
| timetest  | 16:00   | 15:55 | no         | 23h 54min     |
| timetest  | ---     | ---   | ---        | 47h 50min     |
+-----------+---------+-------+------------+---------------+
Only project total
+-----------+---------+-------+------------+---------------+
|  PROJECT  |  START  |  END  |  BILLABLE  |     TOTAL     |
+-----------+---------+-------+------------+---------------+
| test      | 00:37   | 00:37 | no         |               |
| test      | 00:37   | 00:37 | no         |               |
| test      | ---     | ---   | ---        | 0h 0min 18sec |
| edittest  | 12:35   | 12:41 | no         |               |
| edittest  | 12:35   | 12:41 | no         |               |
| edittest  | 09:10   | 09:10 | no         |               |
| edittest  | ---     | ---   | ---        | 0h 13min      |
| time      | 14:46   | 15:10 | no         |               |
| time      | 14:46   | 15:10 | no         |               |
| time      | ---     | ---   | ---        | 0h 47min      |
| seconly   | 15:10   | 15:11 | no         |               |
| seconly   | 15:15   | 15:49 | no         |               |
| seconly   | 15:10   | 15:11 | no         |               |
| seconly   | 15:15   | 15:49 | no         |               |
| seconly   | ---     | ---   | ---        | 1h 8min       |
| timetest  | 15:52   | 15:53 | no         |               |
| timetest  | 16:00   | 15:55 | no         |               |
| timetest  | 15:52   | 15:53 | no         |               |
| timetest  | 16:00   | 15:55 | no         |               |
| timetest  | ---     | ---   | ---        | 47h 50min     |
+-----------+---------+-------+------------+---------------+
With blank row between projects
+-----------+---------+-------+------------+---------------+
|  PROJECT  |  START  |  END  |  BILLABLE  |     TOTAL     |
+-----------+---------+-------+------------+---------------+
| test      | 00:37   | 00:37 | no         |               |
| test      | 00:37   | 00:37 | no         |               |
| test      | ---     | ---   | ---        | 0h 0min 18sec |
|           |         |       |            |               |
| edittest  | 12:35   | 12:41 | no         |               |
| edittest  | 12:35   | 12:41 | no         |               |
| edittest  | 09:10   | 09:10 | no         |               |
| edittest  | ---     | ---   | ---        | 0h 13min      |
|           |         |       |            |               |
| time      | 14:46   | 15:10 | no         |               |
| time      | 14:46   | 15:10 | no         |               |
| time      | ---     | ---   | ---        | 0h 47min      |
|           |         |       |            |               |
| seconly   | 15:10   | 15:11 | no         |               |
| seconly   | 15:15   | 15:49 | no         |               |
| seconly   | 15:10   | 15:11 | no         |               |
| seconly   | 15:15   | 15:49 | no         |               |
| seconly   | ---     | ---   | ---        | 1h 8min       |
|           |         |       |            |               |
| timetest  | 15:52   | 15:53 | no         |               |
| timetest  | 16:00   | 15:55 | no         |               |
| timetest  | 15:52   | 15:53 | no         |               |
| timetest  | 16:00   | 15:55 | no         |               |
| timetest  | ---     | ---   | ---        | 47h 50min     |
+-----------+---------+-------+------------+---------------+

KonstantinGasser avatar May 31 '21 08:05 KonstantinGasser

Thanks, @KonstantinGasser! I'd also prefer the last one as it is the cleanest and simplest approach.

Tablewriter also supports table footers and cell merging. Maybe there is a way to make use of this for the individual projects or for all projects? In the current state of main, out.Table supports footers.

dominikbraun avatar May 31 '21 08:05 dominikbraun

@dominikbraun Cool I fetched the latest main and will try it out! Preferable would be to have a cell merging for each project and each project again as a "footer" with its total + a "group" total of all projects at the end, right?

KonstantinGasser avatar May 31 '21 08:05 KonstantinGasser

@dominikbraun Cool I fetched the latest main and will try it out! Preferable would be to have a cell merging for each project and each project again as a "footer" with its total + a "group" total of all projects at the end, right?

Yes, something like this. But you're totally free to choose the best looking variant 😎

dominikbraun avatar May 31 '21 08:05 dominikbraun

Ok I will experiment a little 😄

KonstantinGasser avatar May 31 '21 08:05 KonstantinGasser

Hi all,

two ideas for timetrace report:

  • can we have a --nonbillable / -B flag for non-billable entries only (the opposite of --billable / -b)?
  • are there plans for --project to include project modules? Currently (v0.11.0) modules are not included when --project is present. Could be done with another flag (--modules / -m).

panmanio avatar Jun 27 '21 14:06 panmanio

@maniowy Thanks for your suggestions! They both make sense and I created two issues for them: #140 and #141.

dominikbraun avatar Jun 27 '21 18:06 dominikbraun

just opened a PR closing #141

KonstantinGasser avatar Jun 27 '21 19:06 KonstantinGasser

also create a PR for filter by module, closing #140

KonstantinGasser avatar Jun 27 '21 20:06 KonstantinGasser

will tags be/optionally be output with the report as well?

c-nv-s avatar Nov 30 '21 01:11 c-nv-s

will tags be/optionally be output with the report as well?

There's issue #202 for that. If no PR will be opened, I'll implement that myself within the next few days.

dominikbraun avatar Nov 30 '21 09:11 dominikbraun