Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Total tracked time #106

Merged
merged 5 commits into from
Jun 7, 2021

Conversation

retronav
Copy link
Contributor

@retronav retronav commented Jun 7, 2021

This PR closes #58. Notable changes in this pull request are:

  • Making formatter.FormatDuration public

PTAL @dominikbraun

@dominikbraun
Copy link
Owner

Thanks, this looks pretty good for me. I've discovered one thing:

The current output looks like this:

+-----+------------------+-----------+---------+-----------+------------+
|  #  |       KEY        |  PROJECT  |  START  |    END    |  BILLABLE  |
+-----+------------------+-----------+---------+-----------+------------+
|   1 | 2021-06-07-12-53 | web-store | 12:53   | 15:57     | no         |
|   2 | 2021-06-07-07-20 |           | 07:20   | 12:08     | no         |
+-----+------------------+-----------+---------+-----------+------------+
|     |                  |           |         |  TOTAL:   |  7H 51MIN  |
+-----+------------------+-----------+---------+-----------+------------+


It would be possible to make it look like so:

+-----+------------------+-----------+---------+---------+------------+
|  #  |       KEY        |  PROJECT  |  START  |   END   |  BILLABLE  |
+-----+------------------+-----------+---------+---------+------------+
|   1 | 2021-06-07-12-53 | web-store | 12:53   | 15:57   | no         |
|   2 | 2021-06-07-07-20 | web-store | 07:20   | 12:08   | no         |
+-----+------------------+-----------+---------+---------+------------+
|                                                TOTAL:  |  7H 51MIN  |
+-----+------------------+-----------+---------+---------+------------+

If there are two or more empty cells next to each other, tablewriter merges the cells as showed in the 2nd output. You're already passing empty cell values to out.Table, but then headersWithPadding adds to spaces and "" becomes " ".

To fix this, you could either check in headersWithPadding whether the current cell is not empty, or even just remove the paddedFooters := headersWithPadding(footer) assignment.

@retronav
Copy link
Contributor Author

retronav commented Jun 7, 2021

I have changed headersWithPadding to not pad empty headers. So the output format is now as expected!

@retronav retronav changed the title WIP: Total tracked time Total tracked time Jun 7, 2021
@retronav retronav marked this pull request as ready for review June 7, 2021 15:08
@dominikbraun dominikbraun self-requested a review June 7, 2021 16:56
Copy link
Owner

@dominikbraun dominikbraun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for implementing this!

@dominikbraun dominikbraun merged commit b472a66 into dominikbraun:main Jun 7, 2021
@retronav retronav deleted the feature_total_tracked_time branch August 5, 2021 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include total tracked time in timetrace list records
2 participants