dominikbraun / timetrace

A simple CLI for tracking your working time.
Apache License 2.0
695 stars 76 forks source link

Add `attach notes` command to allow adding of notes of a record #249

Open davidchua opened 3 months ago

davidchua commented 3 months ago

Problem

When viewing timetrace report at the end of the month in preparation to bill clients, the current information displayed may not provide enough context to what actually happened during each time chunk. And because a full month may have occurred, the memory is no longer fresh to remember what you've did specifically.

Solution

When adding a timetrace record, it would be good to be able to leave a note attached to the record to briefly describe what was being done for this time chunk so that it will be easier to give a breakdown to the clients if they require.

Description

Changes

This PR adds 2 new commands:

And also updates the timetrace report and timetrace get record to display the notes as a new column in the table.

Details

This PR adds a new command called attach which the first subcommand attach note. This also allows users to now pull the latest record without searching explicitly for the last and latest record via timetrace get record last

timetrace attach note -m <message> will allow users to be able to leave contemporary notes about the record that was just submitted.

Example:

Attach a note

➜ ./timetrace attach note -m "Test 4"
✔ successfully attached note "Test 4" to record

Get Last Record

➜ ./timetrace get record last
+------------------------+---------+-------+--------------+------------+---------+
|          DATE          |  START  |  END  |   PROJECT    |  BILLABLE  |  NOTES  |
+------------------------+---------+-------+--------------+------------+---------+
| Tuesday, 04. June 2024 | 08:42   | 09:21 | optimization | yes        | Test    |
|                        |         |       |              |            | Test 2  |
|                        |         |       |              |            | Test 3  |
|                        |         |       |              |            | Test 4  |
+------------------------+---------+-------+--------------+------------+---------+

Get Report

+--------------+----------+------------------------+---------+-------+------------+---------+------------+
|   PROJECT    |  MODULE  |          DATE          |  START  |  END  |  BILLABLE  |  NOTES  |   TOTAL    |
+--------------+----------+------------------------+---------+-------+------------+---------+------------+
| optimization |          | Tuesday, 04. June 2024 | 03:09   | 04:05 | yes        |         |            |
+              +----------+------------------------+---------+-------+------------+---------+------------+
|              |          | Tuesday, 04. June 2024 | 08:42   | 09:21 | yes        | Test    |            |
|              |          |                        |         |       |            | Test 2  |            |
|              |          |                        |         |       |            | Test 3  |            |
|              |          |                        |         |       |            | Test 4  |            |
+--------------+----------+------------------------+---------+-------+------------+---------+------------+
|              |          |                        |         |       |            | ∑       | 1h 34min   |
+--------------+----------+------------------------+---------+-------+------------+---------+------------+
|                                                                                   TOTAL   | 1H 34MIN   |
+--------------+----------+------------------------+---------+-------+------------+---------+------------+

Test

➜ go test ./...
?       github.com/dominikbraun/timetrace       [no test files]
?       github.com/dominikbraun/timetrace/config        [no test files]
?       github.com/dominikbraun/timetrace/fs    [no test files]
?       github.com/dominikbraun/timetrace/out   [no test files]
ok      github.com/dominikbraun/timetrace/cli   (cached)
ok      github.com/dominikbraun/timetrace/core  (cached)