mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 14:03:55 -05:00
Fix type annotations and layout insert call
This commit is contained in:
parent
2330242efc
commit
b9552f530f
2 changed files with 6 additions and 3 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from collections import defaultdict
|
||||
from typing import Dict
|
||||
|
||||
def analyze_activity(col, days=30) -> Dict[str, int]:
|
||||
from anki.collection import Collection
|
||||
def analyze_activity(col: Collection, days: int = 30) -> dict[str, int | float]:
|
||||
day_cutoff = col.sched.day_cutoff
|
||||
start_time = day_cutoff - days * 86400
|
||||
start_ts = start_time * 1000 # ms
|
||||
|
|
@ -28,3 +28,4 @@ def analyze_activity(col, days=30) -> Dict[str, int]:
|
|||
"average_per_day": round(average_per_day, 2),
|
||||
"low_days": low_days,
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -69,7 +69,9 @@ class Overview:
|
|||
|
||||
layout = self.web.layout()
|
||||
if layout is not None:
|
||||
layout.insertWidget(0, streak_widget)
|
||||
layout = self.web.layout()
|
||||
if hasattr(layout, "insertWidget"):
|
||||
layout.insertWidget(0, streak_widget)
|
||||
|
||||
def show(self) -> None:
|
||||
av_player.stop_and_clear_queue()
|
||||
|
|
|
|||
Loading…
Reference in a new issue