jdlorimer / incremental-reading

Anki add-on providing incremental reading features
https://ankiweb.net/shared/info/935264945
ISC License
216 stars 38 forks source link

[v3] Scheduling is broken, card is always moved to 1 #46

Closed aleksejrs closed 5 years ago

aleksejrs commented 6 years ago

Anki 2.0.47 (v4 on Anki 2.1.0 beta 26 seems to work, and the first card is different). I have 3453 cards in my IR deck. The Scheduling settings are 10 and 50 %. The card is always moved to 1. The Organizer is too manual and not convenient (certainly not for 10 and 50 %).

aleksejrs commented 6 years ago

Also, unlike with v4, scheduling is recorded in the card's history:

Date    Type    Rating  Interval    Ease    Time
2017-12-10 @ 23:19  Learn   3   3d  250%    3.2s
2017-12-10 @ 23:18  Learn   2   1d  250%    1.2s
2017-12-10 @ 23:16  Learn   1   1m  250%    1.7s
2017-12-10 @ 23:16  Learn   2   1d  250%    1.7s
2017-12-10 @ 23:15  Learn   2   1d  250%    1.6s
2017-12-10 @ 23:14  Learn   2   1d  250%    4.5s
2017-12-10 @ 23:12  Learn   2   1d  250%    15.6s
jdlorimer commented 6 years ago

I do remember fixing a lot of issues with scheduling in v4. I'll see how much of that I can backport to v3. I understand that Anki 2.0 isn't going anywhere any time soon.

Thanks.

Smingvin commented 6 years ago

New user here (a couple of days), Anki 2.0.41, ir cards always moved to 1 regardless of what I click.

Smingvin commented 6 years ago

I tested the scheduler a bit. This is what happens:

Settings: percentage, randomize.

  1. Any percentage between 0 and 99 will return the card to position 1.
  2. If you set percentage to 100, cards will be moved to (or near) the bottom of the pile.
  3. If you set percentage to above 100 (either 150 or 1000) the cards will be moved to the bottom, while the tooltip will report a proportionate but non-existing index (for example: "card is moved to position 350", even though the deck has 50 cards so it is actually moved to 50)

I hope this information will be helpful for debugging.

SijanC147 commented 5 years ago

I'm not sure if there are any other issues with the scheduler, but the problem that @Smingvin mentions, in particular, is due to the way that python 2 deals with the division of integer values, which are not automatically cast to float, this can be solved one of two ways, both in scheduler.py,

Either change the following line, (which was resulting in 0 every time due to loss of precision):

    newPos = totalCards * (value / 100)

to

    newPos = totalCards * (float(value) / 100)

or, my preferred way is to import the more robust division, by changing the very first line to

from __future__ import unicode_literals, division
jdlorimer commented 5 years ago

@SijanC147, thanks so much for that. I've made the suggested change. Hopefully this resolves the main issue here.