diff --git a/server/app.py b/server/app.py index c9e5dbb..d09834c 100644 --- a/server/app.py +++ b/server/app.py @@ -242,6 +242,11 @@ def timedelta(seconds: int) -> str: #### +@flask_app.teardown_request +def merge_query_stats(*_, **__): + db.merge_local_stats() + + @flask_app.route("/") def dashboard(): # config @@ -506,6 +511,14 @@ def show_stats(): }, ) +@flask_app.route("/stats/queries") +def show_stats_queries(): + stats = sorted(db.global_stats.values(), key=lambda s: s.sum_time, reverse=True) + return render_template( + "stats/queries.htm", + stats=stats, + ) + @flask_app.route("/tag") def show_tag(): diff --git a/server/templates/stats/main.htm b/server/templates/stats/main.htm index f4fcb24..4ec9ca1 100644 --- a/server/templates/stats/main.htm +++ b/server/templates/stats/main.htm @@ -29,5 +29,8 @@ Progress: {{ ((stats.media.watched_seconds / (stats.media.known_seconds - stats.media.ignored_seconds)) * 100) | round(precision=2) }} % +
+ Query Statistics +