Bug: Nested to-do list prematurely marked as complete
Thanks for the lovely plugin. I have noticed that when checking off tasks in nested to-do lists, the parent list level can become prematurely marked as "complete" even if not all of its subtasks are such.
To reproduce
- Make a nested to-do list with many subtasks (e.g. 10):
- [ ] some task:
- [ ] subtask 1
- [ ] subtask 2
- [ ] subtask 3
- [ ] subtask 4
- [ ] subtask 5
- [ ] subtask 6
- [ ] subtask 7
- [ ] subtask 8
- [ ] subtask 9
- [ ] subtask 10
- Tick off subtasks and at the 8th subtask completed, the parent task is incorrectly marked as done
- [X] some task:
- [X] subtask 1
- [X] subtask 2
- [X] subtask 3
- [X] subtask 4
- [X] subtask 5
- [X] subtask 6
- [X] subtask 7
- [X] subtask 8
- [ ] subtask 9
- [ ] subtask 10
Expected behaviour
I feel the parent task should remain at the final "partially complete" state until reaching 100% of its subtasks being completed. If I understand correctly this is what the authors mean it to do as well, since the documentation states as such.
Pretty sure the issue is the usage of ceil here https://github.com/bullets-vim/bullets.vim/blob/master/plugin/bullets.vim#L1395
Yeah. Dropping that fixes things. Could you create a PR?
@harshad1 there is already a PR. removing ceil fix the issue from @yutanagano but when the scenario is like below it leave the parent checkbox empty.
- [ ] some task:
- [X] subtask 1
- [ ] subtask 2
- [ ] subtask 3
- [ ] subtask 4
- [ ] subtask 5
- [ ] subtask 6
- [ ] subtask 7
- [ ] subtask 8
- [ ] subtask 9
- [ ] subtask 10
i think it should be like this:
- [.] some task:
- [X] subtask 1
- [ ] subtask 2
- [ ] subtask 3
- [ ] subtask 4
- [ ] subtask 5
- [ ] subtask 6
- [ ] subtask 7
- [ ] subtask 8
- [ ] subtask 9
- [ ] subtask 10
I'll take a look at the math and potentially merge the fix
@hoarse-boy would you be willing to add a test to that PR? It is described in the comments.
@hoarse-boy would you be willing to add a test to that PR? It is described in the comments.
@harshad1 sorry for the late reply.
you mean the comments in that PR?
btw, i have never code vimscript as i'm a nvim lua user so maybe it will take quite some time. i will take a look later when i have the time.
The tests are actually in Ruby. If you look at the comments and the existing tests they're pretty easy to write.
I help maintain this project and I have never written Ruby outside of the tests here :)
The tests are actually in Ruby. If you look at the comments and the existing tests they're pretty easy to write.
I help maintain this project and I have never written Ruby outside of the tests here :)
@harshad1 i see, i could try. never done ruby though. i will check it out later.
Also see #101 and #164