Bug: notes are imported to the wrong deck in certain cases

How to reproduce

  • Review some cards in deck A
  • Select deck B and add a new note to it
  • Import some notes using File > Import. The import dialog shows deck B as the destination deck as expected, but the notes get imported to deck A actually.

These are just rough steps; I couldn’t figure out the exact steps, but repeating the above a couple of times with some small variations should trigger the issue.
This hit me many times recently. I made sure the deck override option is off.

The importing code in aqt/importing.py ensures that the selected deck in the deck chooser matches importer.model["did"] and some print-debugging can show that deck.selectedId() matches importer.model["did"] before the check anyway. So, I’m at loss here.

If you force model.save() to be called even if the did is the same in aqt/importing.py, does that make a difference?

1 Like

This seems to fix it; I can no longer reproduce the issue.