Correct edition of card in filtered deck #5531
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I believe that this pull request corrects issue #3200, issue #3409, #5222 and
issue #5184(this is the best report, it gives a LOT of details) which
seems to be thrice the same trouble.
The note editor contains a list of deck. This allows to select in
which deck to put the cards of the new notes. It also allows to move
the current card if it already exists (i.e. if we edit a card while
reviewing it). The default value finally allows to knows the deck of
the card (assuming the card exists).
The trouble being that the deck of the card is not necessarily in the
list of decks. In this card, the editor believes that we want to
change the deck of the card; which is not the case.
Thus this pull request simply add the deck of the current card to the
list of deck. Note that instead the current deck is not anymore added
to the list. However, it creates no trouble because:
in the added to the list since it's the deck of the card.
hence it's already in the list.
So actually this pull request only ensure that one more deck is added
in the case where the card reviewed is in a filtered deck, which is a
children of the selected deck. In any other case it does not change
anything.
I must state that I believe that ankidroid should not behaves as it
behaves now. Indeed, the fact that there is a single filtered deck in
the list means that choosing this deck has a meaning different from
the meaning of choosing any other deck. However, the GUI does not
emphasize the fact that the meaning of the filtered deck is different
from the meaning of the other decks.
However, even if I don't like this behavior, it is the current
behavior when you edit a card and the selected deck is filtered. So I
believe that it should remains the behavior when the deck of the card
is filtered, even if it's not the selected deck.
Fixes
#3200, issue #3409 and issue #5184(this is the best report, it gives a LOT of details)
Approach
By ensuring that the deck of the current card is in the list of decks.
How Has This Been Tested?
I did test this commit by following the steps of
#5184 (comment)
and checking that the problem did disappear. Furthermore, editing any
other card does not create any trouble.
Learning (optional, can help others)
That writing a message in a bug report such as #3409 (comment) is not enough, and that I've got to correct the bug myself.
Not sure it can help others actually.
Checklist
Please, go through these checks before submitting the PR.
if
statements)