From fadb0fffcdba4732a9e04088bc8eb5186223e2d7 Mon Sep 17 00:00:00 2001 From: Mattias Thall Date: Wed, 27 May 2026 01:18:49 +0200 Subject: [PATCH] Add started_count to stats (videos in progress, not yet finished) Tracks watch_progress_seconds > 0 AND watched = 0. Shown as "In progress" card in the engagement row alongside finished/bailed/rewatched. Total liked moved to engagement row, top row condensed to 3 cards. Co-Authored-By: Claude Sonnet 4.6 --- backend/routers/stats.py | 10 ++++++++++ frontend/src/pages/Stats.jsx | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/backend/routers/stats.py b/backend/routers/stats.py index 0a7f36c..5cc263d 100644 --- a/backend/routers/stats.py +++ b/backend/routers/stats.py @@ -136,6 +136,15 @@ def get_stats( {"uid": uid}, ).mappings().first() + started_count = db.execute( + text(""" + SELECT COUNT(*) AS n FROM user_videos + WHERE user_id = :uid AND watched = 0 + AND watch_progress_seconds > 0 + """), + {"uid": uid}, + ).mappings().first() + try: disk = shutil.disk_usage(settings.download_path) download_bytes = sum( @@ -164,6 +173,7 @@ def get_stats( "total_rewatches": avg_completion["total_rewatches"] or 0, "rewatched_videos": avg_completion["rewatched_videos"] or 0, "total_liked": liked_count["n"] or 0, + "started_count": started_count["n"] or 0, "top_categories": [dict(r) for r in top_categories], "peak_hours": [dict(r) for r in peak_hours], "taste_profile": [dict(r) for r in taste_profile], diff --git a/frontend/src/pages/Stats.jsx b/frontend/src/pages/Stats.jsx index a566cff..55345ca 100644 --- a/frontend/src/pages/Stats.jsx +++ b/frontend/src/pages/Stats.jsx @@ -70,15 +70,14 @@ export default function Stats() {

Stats

{/* Top numbers */} -
+
-
{/* Engagement row */} -
+
+ +
{/* Activity chart */}