samg / timetrap

Simple command line timetracker
http://rubygems.org/gems/timetrap
Other
1.48k stars 116 forks source link

Formatter: Quota #187

Closed NobodysNightmare closed 3 years ago

NobodysNightmare commented 3 years ago

Hey there,

I wanted to thank you a lot for making timetrap. I use it literally every day I work.

Recently (start of the year) I built a formatter that I would use, whenever I wanted to know whether I am working more or less (on average) than I want to (i.e. what my contract says). The quota formatter does just that:

$ tt
Timesheet: coding
// --- snip (rest of the year) ---
2020-10-08  8:01:42  8:00:00
2020-10-09  8:04:34  8:00:00
2020-10-12  6:59:42  8:00:00

Total 1219:39:53 1216:00:00
Balance:  3:39:53

For each day where at least one entry was logged, it will expect this to be a "presence" day, where 8 hours are required. Cases like weekends or vacation are covered by not logging anything. Half days of vacation are a little tricky and I would add a "filler" entry of 4 hours.

I found this formatter quite useful to me, so I wanted to try upstreaming it, in case it is useful to someone else.

Disclaimer

I don't think I would merge this pull request as-is myself just yet. I'd rather see this as a discussion starter.

My questions for now are:

categulario commented 3 years ago

Hi @NobodysNightmare !

This looks very useful, I would probably use it myself.

As you mentioned, there are a few things worth thinking about, like where to put the settings for it. In my use-case I would need a quota setting per sheet. Perhaps a command line argument would be a good initial way to solve it.

As per the "where" to put it. Did you take a look at https://github.com/samg/timetrap_formatters ?

NobodysNightmare commented 3 years ago

Apparently I totally missed that samg/timetrap_formatters existed, as well as the fact that formatters can go to ~/.timetrap/formatters and I do not need to fork the whole repository and use a forked version of Timetrap locally.

That's good to know :D

I am going to reopen this MR over there soon and will have a look at how command-line arguments are passed around in Timetrap, as well as checking whether timetrap configure is a proper or wrong tool for the task.