diff --git a/pylib/anki/anki_helpers/activity.py b/pylib/anki/anki_helpers/activity.py index 002314031..8dd5e5cd0 100644 --- a/pylib/anki/anki_helpers/activity.py +++ b/pylib/anki/anki_helpers/activity.py @@ -1,7 +1,9 @@ from collections import defaultdict -from typing import Dict +from typing import Dict, Union from anki.collection import Collection -def analyze_activity(col: Collection, days: int = 30) -> dict[str, int | float]: + +def analyze_activity(col: Collection, days: int = 30) -> dict[str, Union[int, float]]: + day_cutoff = col.sched.day_cutoff start_time = day_cutoff - days * 86400 start_ts = start_time * 1000 # ms diff --git a/qt/aqt/overview.py b/qt/aqt/overview.py index b577922e5..cec682c00 100644 --- a/qt/aqt/overview.py +++ b/qt/aqt/overview.py @@ -70,7 +70,7 @@ class Overview: layout = self.web.layout() if layout is not None: layout = self.web.layout() - if hasattr(layout, "insertWidget"): + if layout is not None and hasattr(layout, "insertWidget"): layout.insertWidget(0, streak_widget) def show(self) -> None: