wakatara / harsh

Habit tracking for geeks. A minimalist, command line tool for tracking and understanding your habits.
MIT License
133 stars 11 forks source link

Add quantity tracking #25

Closed crashmoney closed 7 months ago

crashmoney commented 8 months ago

Is your feature request related to a problem? Please describe.

harsh is a great habit tracker and does almost everything I need (including logging comments!), but one roadblock I'm consistently running into is tracking quantities. Many of my habits – language learning lessons or words written – rely on quantities and a certain goal, rather than yes/no/skip habits like waking up by a certain time.

Describe the solution you'd like

The ability to track quantities and set goals for habits to count as fulfilled or partially fulfilled. This can be done through either a new sub-command or – in the interest of keeping things minimal – a new syntax option. Hashes (#) can stay reserved for comments, and another symbol (perhaps equals =?) can denote a quantity.

An alternative habit tracker I've tried recently is habito, which does a great job at quantities but unfortunately lacks harsh's comment logging.

Describe alternatives you've considered

Manually logging quantities as comments has certainly crossed my mind, but a couple of flaws lie in this. Namely:

wakatara commented 8 months ago

Heya @crashmoney

Thanks for using the app! And... Interesting. I had not thought of supporting quantities, mostly because I always think about you hitting that goal as a yes/no thing, but understand how it might be very useful for tracking purposes over time (to be fair, someone else did ask for a similar thing a while back but it was a much more complex ask quantification-wise... or at least, I thought it was.).

Can I understand how you'd expect the functionality to work here? Of the top of my head, since I imagine I can implment this with not too much fuss, I'm assuming you've have something like (just an example):

Write 1000 words a day as a habit. Then in the line for the entry when you're asked about it, you'd write something like a line like:

y @ 1250 # Crushed the goal for today

which would record the num and also marked the goal as achieved (or are you expecting the goal to somehow be "number aware"?

For a day you didn't make it:

n @ 350 # Got distracted by work email being open when I started

Would that work? The thing I'd like to avoid doing is that the habit itself somehow needs to be "number aware" So, you're just using the entry for tracking (and possibly me rolling things up into additions and such, but that the signal for the actual yes, done vs nope, missed came from the y n s used in answering each line.

Thoughts?

crashmoney commented 8 months ago

Hey @wakatara! The suggestions you made were almost exactly what I had in mind.

I completely understand not making the habit "number aware", and fully agree – the onus would be on the user to manually mark y/n/s. What do you think about responses like n @ 150 # almost there and y @ 350 # crushed it! and addition to show 500 words written in statistics for the day?

Some way to show the data (using habito as a reference again, the table output of habito list -l) and extract the quantities would be great, too 😄

wakatara commented 7 months ago

Heya @crashmoney !

So, I've gotten the initial implamentation of this done this evening and just need to write up the docs tomorrow before pushing this.

The general idea is this: for a particular habit you can add amounts for the day to any habit. So for something like words written you'd just amend it on the ask line. example:

Weeklies
                      Write  ─━────────       ━━──•─━━───────━──────━─━─━─━━────━━───━─━   [y/n/s/⏎] 

So, let's say you wanted to mention you'd actually written some stuff, so you'd write the line (goal in habit text or no)

y @ 500 # Drafted blog post on Prefect

This then adds an extra : 500 onto what the normal log file line would be.

When the file is parsed it adds the amount (as a floating point num) into the Outcome struct for that Habit Day for math opps.

So far, for stats I've just added "Totals" to the harsh log stats command, but hey it's.a start.

One caveat: This means you just answer this daily as an amount. It does not dynamically update for day (though I might tackle an idea for that next.). At the moment, it's just your total for the day.

Looks to see that pushed as a release in the next day or so. Just tidying up some code and then, like I said, need to write the documentation and merge in the branch before cutting the new release.

lemme know how that all strikes you.

wakatara commented 7 months ago

Fresh off the presses, version 0.9.0 has quantities tracking. Please read the updated README for details.

https://github.com/wakatara/harsh/releases/tag/v0.9.0

crashmoney commented 7 months ago

Hey @wakatara, I just updated harsh. Dynamic update and per-day stats are definitely possible next steps, but the basic skeleton of the feature has been implemented very nicely. TBH, I rely on both a fair bit in my workflow, but it's nothing a bit of manual editing can't fix for now 😄

Thanks for all your work on it – it looks great!