Fix missing minus symbol when updating tags in card browser
Purpose / Description
Fix missing minus symbol when selecting several cards at once in the card browser to update tags.
Fixes
- Fixes #19083
Approach
Problem
This happened because the previous implementation
- treated all notes present in any note as "checked"
- remaining all were marked as "unchecked
Expected
- tags present in all notes : "checked"
- tags present in some, but not all notes: "indeterminate"
- tags present in none of the notes: unchecked
Fix
- check all notes, check if each tag is present or absent
- add to checked list if present else add to unchecked list
- this operations might result in few tags being present in both lists
- intersecting tags are the "indeterminate" ones which are correctly captured by [TagsList]
- tags coming from intent's
extrasare treated as absolutecheckedand cannot be indeterminate
How Has This Been Tested?
Added unit test for "indeterminate" Existing tests pass Manually Tested
Checklist
- [x] You have a descriptive commit message with a short title (first line, max 50 chars).
- [x] You have commented your code, particularly in hard-to-understand areas
- [x] You have performed a self-review of your own code
- [x] UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
- [ ] UI Changes: You have tested your change using the Google Accessibility Scanner
Also, the tests assume NoteList works as expected, any error in NoteList will result in ViewModelTest to fail, even though actual issue might not be in the ViewModel.
As a request: could the conclusion of this be moved into the class/argument documentation:
It's there as a test, will include in docs too.
Todos before next approval:
- [x] Add the conclusion to docs 19499#discussion_r2532184695
- [x] Replace if-else partitioning with Array::partition
- [ ] ~Lift up db call out of loop~
- [x] Add a todo for "Lift up db call out of loop"
@david-allison per discussion on discord, queue for release-2.23 pick or not? I think we decided not - but perhaps later after alpha testing verifies it's working?
As discussed, a little too much risk. My mistake last year with tags still haunts me.
Let's aim for a fairly quick 2.24 with this in