giovannihenriksen / Anki-Simulator

Simulator for Anki
GNU Affero General Public License v3.0
76 stars 11 forks source link

TypeError in CollectionSimulator.generate_for_deck #24

Closed glutanimate closed 4 years ago

glutanimate commented 4 years ago

Just got a user reporting this issue:

bug

Seems like cardDue might be a float under some circumstances.

(Thanks to Samer over on Patreon for the report)

glutanimate commented 4 years ago

Following up with the user to see if I can get a sample deck in order to understand under which circumstances cardDue might be a float.

glutanimate commented 4 years ago

Looked into the deck Samer sent me. Seems like some of his cards actually had a decimal ivl. This could have either been introduced by a bug with the V2 scheduler or an add-on. The V2 bug was fixed back in Anki 2.1.9: https://github.com/ankitects/anki/commit/41f1ef02de910f61370414d3a3718d0d7d201fa8 https://github.com/ankitects/anki/commit/d0fb87d432f5054e4eb2861dd566a5a3a3c4b73f https://github.com/ankitects/anki/pull/272

Since the user is using a much more recent Anki version, and the review log on that card only spans back 2 weeks, it seems more likely that the erroneous ivl values were caused by an add-on. Will see if I can find out which add-ons he's using that might be interfering with scheduling.

Checking the database should provide an immediate fix on the user's side, but for our add-on's purposes we should take ivl potentially being a float into account, and cast it / round it into an int just to be safe (in the same way as the fix in Anki's database checker does). Will push a commit to that effect.