[Bug(?) Report] When the original due is less than 0, the due will be weird when empty the filter deck

It’s caused by several abnormal cases.

A user of FSRS shared two affected cards with me. I checked their initial state in the database:

I found that the first card’s due is 13, which is very small. I checked its card’s info;

The last due is definitely less than 0. It caused the subsequent bug.

I created a filtered deck, and checked the database:


It seems normal. The due has been storage in odue. Then I rescheduled the deck with FSRS Helper add-on, which will modify the odue when the card is in a filtered deck:


The ivl was shortened by FSRS. So the odue decreases, to a negative integer (-44). Then I emptied the deck, and checked the database:


The bug appeared. Its due was not replaced with odue. I don’t know why. I read the source code of Anki:

In L106, it will check whether original due is greater than 0 before recover the due. It caused the bug in this case. Is it designed on purpose? @dae

Thanks for the report; I’ve pushed a fix.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.