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 */}