The new note should go to the right deck
The new note ends up in a seemingly random deck
This bug is IMO of high priority as there are no ways for the user to know that it happened. If the user has not set tags for this note he could have a very hard time to find where it ended up. And as the new note has the same creation date as the original one (I think?) it means you can't really find it without tags or by note type.
In my case, that meant that my exam related cloze was added somewhere in my gigantic spanish shared deck, had I not understood what happenned, I could have screwed up quite a lot.
A friend of mine confirmed that the issue happened on her ankidroid too.
AnkiDroid Version = 2.14.1
Android Version = 9
ACRA UUID = 665666ae-6d44-4276-9d91-4d0b78412437
Scheduler = std2
Thanks for the report. Is this a regression in 2.14, or did this occur in 2.13?
Relevant code:
Using the reference (sEditorCard):
@thiswillbeyourgithub Does this occur on Anki Desktop? Do the cards appear in different decks?
Relevant code:
Hi, thanks for the quick reply.
I never noticed this on desktop and I use this a lot so I don't think it happens there.
I'm positive this happened on 2.14.0 I just asked my friend if she noticed this in 2.13 but I don't know when she'll answer sorry
No worries. I'm likely going to need concrete reproduction steps with a test deck to take this further.
I think this is likely caused by two cloze cards being in different decks, but if this isn't the case, I'll get on it ASAP.
A similar problem happens to me as well. I don鈥檛 use Anki鈥檚 built-in cloze deletion mechanism, but Cloze Anything. It uses Anki鈥檚 selective card generation feature in order to create cards for the cloze deletions (see the instructions):
{{#ExpressionCloze}}
{{#ExpressionCloze1}}
HTML+JS goes here
{{/ExpressionCloze1}}
{{/ExpressionCloze}}
Since 2.14.0 when I edit a cloze deletion field in order to create a new cloze deletion card (for example, changing ((c1::Hello, world!)) to ((c1::Hello,)) ((c2::world!)) and changing ExpressionCloze2 from an empty string to 1) the new card may end up in the wrong deck. I noticed it when some new cards that were made this way appeared in the default deck (which is usually empty, hence invisible), making it shown in the deck list. I upgraded to 2.14.1 in hope for a fix, but the problems persists. I鈥檓 quite sure this didn鈥檛 occur in 2.13, since I made a lot of such cloze deletion cards using 2.13 over a period of time and they all seem to be in place.
Looking at the changelog, the line Card Browser: Adding cards defaults to selected deck might have to do with this.
If you want any additional information so you can solve this bug, I will be happy to provide it.
I agree with @thiswillbeyourgithub: this is extremely problematic because it happens quietly, without the user knowing their cards are scattered in the wrong decks.
Having a sample deck which can reproduce this problem would be very helpful. GitHub accepts zip uploads, or this can be emailed to me at my gmail: davidallisongithub.
Card Browser: Adding cards defaults to selected deck was only for the "Add" functionality, and did not touch the code of the note editor.
Thanks! I will try to make a minimal scenario in which the problem is reproducible.
@thiswillbeyourgithub, would you like to do so as well for your problem with the built-in cloze deletion mechanism, in case the particularities are different?
Thanks for the confirmation, reproduced no more action necessary.
Cause (I believe): 554ce84211efc17b8503acf45be600497f873d47
Confirmed: 554ce84
git bisect reset
git bisect start
git bisect bad
git bisect good 18c7cde8ab8655b7ea4854884f7d979c53dd57f1
git bisect run ./gradlew AnkiDroid:testDebug --tests "*editClozeGenerateCardTest*"
----
dd4ba470ed3b228cb64087469008ff0266e69d98 is the first bad commit
commit dd4ba470ed3b228cb64087469008ff0266e69d98
Author: Redacted
Date: Fri Oct 23 16:29:04 2020 +0200
NF: avoid multiple conversions to Long
.../src/main/java/com/ichi2/libanki/Collection.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
bisect run success
Note to self: add bisect instructions for Windows to the Development Guide - keep on forgetting the syntax
Thank you so much for the quick fix! 馃檪馃帀
I cannot compile and check it at the moment.
So the difference between the types (Long vs. long), introduced by this commit, led dids.get(nid) != did to be true while in fact it should not have been; do I understand this correctly?
Thank you so much for the quick fix! 馃檪馃帀
I cannot compile and check it at the moment.
So the difference between the types (
Longvs.long), introduced by this commit, leddids.get(nid) != didto be true while in fact it should not have been; do I understand this correctly?
Yep - we'll get an alpha out soon.
Here's the data in a debugger before the fix

Most helpful comment
Yep - we'll get an alpha out soon.
Here's the data in a debugger before the fix