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

at-most habit starts at 100% score #1962

Closed dovahgab closed 3 months ago

dovahgab commented 3 months ago

Hi, I'm opening this issue as I find it a functional inconsistence, but feel free to move it.

When a habit is created with type 'at most' (e.g. smoke at most 2 times a day), the habit starts at 100% score even without any data - I would say because it considers no data as 0 smokes and thus fulfilled. This contrasts the general behaviour of the app of starting habits at 0% and gradually increases the score.

Thanks for your work! Yo

hiqua commented 3 months ago

I haven't looked at that code in a while, but I think it's because if there's no entry, we assume that means 0.

So one of the default values (either the score or the entry) would have to change, so it'd be inconsistent in any case.

dovahgab commented 3 months ago

Hm yeah, don't know if it's possible to change one of the two for this specific type of habit only - otherwise it is not so useful, if it starts from 100% (and there's no easy way of translating it into a at-least version) only workaround, flatten it to a yes/no habit

jayb-g commented 3 months ago

@hiqua maybe, in case of at most targets, the data for a day has to be <=target for it to be considered a yes internally and progress is made, but when data is higher than at most target, progress should suffer(which is not happening). I tested with sample habit of target at most 10, and entered 50 for each day, the progress is still around 75%. Should be 0%.

Maybe starting at most measurable habits with default of no data(instead of 0)would help. It would work for at least habits too. Calculate progress only based on data entered, whether 0 or non-zero.

hiqua commented 3 months ago

@jayb-g you're talking specifically about the score right? Saying that the score computation should ideally ignore all entries up to the first one entered?

jayb-g commented 3 months ago

@hiqua yes, scores in case of Measurable habits. I believe ultimately when it comes to showing progress percentage (circle), its basically a yes or no average same as a Yes or No habit type.

Score computation should ideally ignore all the missing data(instead of defaulting to 0). I know this would not reflect accurate tracking due to missing data but its the best(it would be accurate for the days data is provided for) it can do if data is not provided for some days by user. Alternatively maybe count missing data as skip days by default ? I realized skip days would increase the score.

iSoron commented 3 months ago

Thank you for the bug report, @dovahgab, but this is working as intended.