iSoron / uhabits

Loop Habit Tracker, a mobile app for creating and maintaining long-term positive habits
GNU General Public License v3.0
7.47k stars 916 forks source link

Score calculation for "at most" measurable habits is incorrect #1991

Open wobbba opened 1 month ago

wobbba commented 1 month ago

This is related but not identical to #1962.

Problem

When I have an "at most" measurable habit and do not enter a value for a day, I would expect the score to go down, as I have not completed the goal. To illustrate, this is my scenario:

I have a habit "get up" in which I track the time it takes me to get out of bed. When I have not entered something, it means that I'm letting this goal slide, usually meaning I did not actually get out of bed in less than 30 min (which is the target value). As a result, I would want the score to reflect this by going down. Instead, it goes up, thereby rewarding me for not sticking to it, which is the opposite of what I want.

Proposed Solution

Maybe other people have other expectations but my proposed solution is flexible:

Let users specify a default value for habits.

When no value is entered, the score calculation uses this value instead of always defaulting to 0. If the user wishes for a default value of 0, they can still do that, and if 0 is the default "default value", nothing would change for users unless they want it to change. In my example, I would specify that no entry defaults to 60min. This way I can also control how much I'm being punished for not entering a value.

Related but not directly relevant

I would also like to be able to set a default value for yes/no habits, so I don't have to check certain habits manually every day (that I'm unlikely to break often, e.g. "eat vegan"). But I still want to track if I'm letting it slide too much. A default value of "checked" would solve this. So adding the "default value" functionality would have multiple benefits.

I am willing to code this up and create a PR if I get a thumbs up from @iSoron.