Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logic bug with bit-type auto-tracked habits #61

Open
christianboyle opened this issue Aug 5, 2020 · 5 comments
Open

Logic bug with bit-type auto-tracked habits #61

christianboyle opened this issue Aug 5, 2020 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@christianboyle
Copy link

If you have an auto-tracked habit that is defined as bit-type it will incorrectly toggle the state when multiple events occur in succession that result in an even-numbered state since it's bool and not checking for existing 1 state prior to toggling.

So the result is if I have commit defined as bit-type and make 3 commits it will show as incomplete in the display, but if I make a fourth commit it will be marked complete.

2020-08-05_11-02-31AM

@nerdypepper
Copy link
Owner

Bit type habits intentionally work like this, a track-up will turn a

  • untracked day into a true
  • true into a false
  • false into a true

a track-down will turn a

  • true into a false
  • false into an untracked day
  • untracked day into an untracked day (no action taken)

I agree that track-up toggling a bit doesn't make much sense, in terms of language, however, it is meant to mimic the function of pressing Enter at the UI.

@christianboyle
Copy link
Author

Ah, that makes sense. But it still seems confusing in the case of auto-tracked bit-type habits, because if I make 5 commits it will result in the day being marked false, but if I make 6 then it's true.

Some possible options:

  1. Add handling to sum of the numerical value of track-up and track-down calls and if the result is greater than zero it is considered true and takes precedence over the bit-type toggled state.
  2. Add a note in the Auto Habits documentation that explains how habits defined as bit-type will result in this type of behavior if you are using it in conjunction with something like Git hooks (and it's probably better to use a numerical goal for Auto Habits).

@nerdypepper nerdypepper added the documentation Improvements or additions to documentation label Aug 6, 2020
@skbolton
Copy link

I agree with @christianboyle that something needs to change here. I currently don’t use any auto bit habits even though I have some use cases for them. The reason is I have no idea whether my hooks are running for the first time and should track up or if it’s already tracked and should do nothing.

I agree that track-up toggling a bit doesn't make much sense, in terms of language, however, it is meant to mimic the function of pressing Enter at the UI.

This makes sense in the use case of the ui where I can see the affects of pressing enter and realize it didn’t do what I expected to. Hooks into scripts don’t have this luxury.

Ps thanks for this library been using it for weeks now.

@nerdypepper
Copy link
Owner

The reason is I have no idea whether my hooks are running for the first time and should track up or if it’s already tracked and should do nothing.

I had mentioned this in another thread, but I am thinking of writing some kinda query system, so dijo be fully programmable externally. You can query for the existing value and take actions based on that (roughly).

@skbolton
Copy link

That would work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants