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 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 01:18:49 +02:00
parent 9d35cc7c68
commit fadb0fffcd
2 changed files with 22 additions and 3 deletions

View File

@@ -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],