glutanimate / review-heatmap

Anki add-on to help you keep track of your review activity
https://ankiweb.net/shared/info/1771074083
Other
1.2k stars 88 forks source link

NotFoundError after deleting ignored deck #156

Closed glutanimate closed 2 years ago

glutanimate commented 2 years ago

When considering the deck activity to take into account, we currently do not explicitly filter out ignored decks that have since been deleted. This causes Anki's backend to raise a NotFoundError.

Given that this has only surfaced now, it's likely that some change, either internal to Anki or in our use of its APIs, now causes us to traverse a different code path that no longer fails silently.

Error message:

Debug info:
Anki 2.1.52 (ab1c2395) Python 3.9.7 Qt 5.14.1 PyQt 5.14.1
Platform: Mac 12.3.1
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-05-22 14:00:21
Add-ons possibly involved: ⁨Review Heatmap⁩
Traceback (most recent call last):
File "aqt.main", line 573, in loadCollection
File "aqt.main", line 672, in moveToState
File "aqt.main", line 678, in _deckBrowserState
File "aqt.deckbrowser", line 69, in show
File "aqt.deckbrowser", line 144, in _renderPage
File "aqt.deckbrowser", line 153, in __renderPage
File "aqt.hooks_gen", line 1444, in __call__
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/views.py", line 81, in on_deckbrowser_will_render_content
heatmap_html = self._controller.render_for_view(self._view)
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/controller.py", line 77, in render_for_view
return self._renderer.render(view, limhist, limfcst, current_deck_only)
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/renderer.py", line 152, in render
report = self._reporter.get_report(
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/activity.py", line 134, in get_report
history = self._cards_done(
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/activity.py", line 471, in _cards_done
deck_limit = self._revlog_limit(current_deck_only)
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/activity.py", line 374, in _revlog_limit
dids = self._valid_decks(excluded_dids)
File "/Users/user/Library/Application Support/Anki2/addons21/1771074083/activity.py", line 351, in _valid_decks
children = [d[1] for d in self._col.decks.children(did)]
File "anki.decks", line 460, in children
File "anki.decks", line 453, in deck_and_child_name_ids
File "anki._backend.generated", line 454, in get_deck_and_child_names
File "anki._backend", line 146, in _run_command
anki.errors.NotFoundError

Thanks to /u/GabiGrice_FalcoBraun for the report over on Reddit