Incremental Reading Add-on (unofficial clone)

Two errors occurred in the pre-release Anki23.10(Beta), so I fixed them a bit.

If IR add-on is enabled, it is completely impossible to review(answer is not displayed). Maybe the introduction of FSRS in the default Anki may have affected this. The error occurs whether FSRS is set ON or OFF.

  • [ Error 1 ]
Debug info:
Anki 23.10 (1f6938d7) Python 3.9.15 Qt 6.5.2 PyQt 6.5.2
Platform: Windows-10-10.0.22621
Flags: frz=True ao=True sv=3
Add-ons, last update check: 2023-09-27 13:50:55
Add-ons possibly involved: <U+2068>Incremental Reading v4118 unofficial clone<U+2069>

Caught exception:
Traceback (most recent call last):
  File "aqt.webview", line 608, in handler
  File "aqt.reviewer", line 685, in _onTypedAnswer
  File "aqt.reviewer", line 432, in _showAnswer
  File "aqt.reviewer", line 743, in _showEaseButtons
  File "aqt.reviewer", line 825, in _answerButtons
  File "aqt.reviewer", line 806, in but
  File "decorator", line 232, in fun
  File "anki.hooks", line 89, in decorator_wrapper
  File "anki.hooks", line 86, in repl
  File "C:\Users\shigg\AppData\Roaming\Anki2\addons21\999215520\main.py", line 212, in buttonTime
    return _old(self, i)
TypeError: _buttonTime() missing 1 required positional argument: 'v3_labels'
  • [ Error 2 ]
Traceback (most recent call last):
  File "aqt.webview", line 608, in handler
  File "C:\Users\shigg\AppData\Roaming\Anki2\addons21\999215520\view.py", line 122, in callback
    self._settings['scroll'][str(mw.reviewer.card.id)] = currentPos
AttributeError: 'NoneType' object has no attribute 'id'
  • [ Fix ]

I tried to fix the errors as these, then the errors stopped occurring. But I am not familiar with IR add-ons, so I am not sure if these fixes are correct.

  • [ main.py line 209 ] v3_labels
def buttonTime(self, i: int, v3_labels: Sequence[str], _old: Any) -> str:
    if isIrCard(mw.reviewer.card):
        return '<div class=spacer></div>'
    return _old(self, i, v3_labels)
  • [ view.py line 118 ] and mw.reviewer.card is not None
    def _saveScroll(self, event=None):
        if viewingIrText() and mw.reviewer.card is not None:

            def callback(currentPos):
                self._settings['scroll'][str(mw.reviewer.card.id)] = currentPos

            mw.web.evalWithCallback('window.pageYOffset;', callback)
  • [ FSRS ]

Strange, after making these two fixes, it looks like the issue with the known interference in FSRS4 is also resolved.

FSRS4 and IR with custom schedules were incompatible and button due dates were always broken. But the new default FSRS and IR have correct button due dates.

In short, FSRS4 with custom schedule is not compatible with IR, but is compatible with the default Anki FSRS. I have not checked FSRS4Helper yet.

2 Likes