8000 Total tracked time by retronav · Pull Request #106 · dominikbraun/timetrace · GitHub
[go: up one dir, main page]

Skip to content

Total tracked time - #106

Merged
dominikbraun merged 5 commits into
dominikbraun:mainfrom
retronav:feature_total_tracked_time
Jun 7, 2021
Merged

dominikbraun merged 5 commits into
dominikbraun:mainfrom
retronav:feature_total_tracked_time

Conversation

@retronav
@retronav retronav commented Jun 7, 2021
Copy link
Copy Markdown
Contributor

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

  • Making formatter.FormatDuration public

PTAL @dominikbraun

@dominikbraun
Copy link
Copy Markdown
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
< 8000 a class="author Link--primary text-bold css-overflow-wrap-anywhere " show_full_name="false" data-hovercard-type="user" data-hovercard-url="/users/retronav/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="/retronav">retronav commented Jun 7, 2021
Copy link
Copy Markdown
Contributor Author

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
@dominikbraun dominikbraun left a comment
Copy link
Copy Markdown
Owner

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

0