kaegi / MorphMan

Anki plugin that reorders language cards based on the words you know
Other
260 stars 66 forks source link

Doesn't properly undo learning a morph when undoing the first review for a card #302

Open IshiRenga opened 1 year ago

IshiRenga commented 1 year ago

When a new card is given a grade and then is undone (e.g. ctrl+z), and when the card would have come back to be regraded, morphman pops up a message saying that a card with a morph learned today was buried and skips it.

I believe this was introduced in the latest update (v5.0-qt6-alpha.2) because burying cards with morphs learned that day was broken a while ago, but I'm not sure.

mortii commented 1 year ago

Yeah, I'm able to reproduce the problem. Fixing it is probably going to take some finessing with collection checkpoints or something like that since multiple cards could have been buried after the grading took place. I'll try to fix it when I have time. Thanks for reporting it!

mortii commented 1 year ago

Fixing this isn't super easy because to the undo process is fairly obfuscated, building anki from source and debugging the rust code seems to be the only way to gain some insight into it. It is further complicated by the need to keep ‘seen_morphs’ in sync with any undo and redo.

That being said it should definitely be possible, fsrs4anki-helper uses col.merge_undo_entries(), and using a custom CollectionOp is also a potential approach.

Since this is going to require a significant amount of time and effort to fix I’ll do it after having finished the new guide and fixed the browser actions.