Repository navigation
fix(admin): count only finished plays on the dashboard leaderboards - #3388
Conversation
Every playback stop writes a watch-history row, and the Top titles and Most active profiles widgets counted each one as a play. A title watched in ten sittings showed ten plays, and a title abandoned partway still ranked. Count completed playback rows only, as the per-item play counts already do. Watch time is unchanged and still includes every sitting. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 9 minutes. View limit details
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The Evidence section contains only
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness. Posted via Macroscope — Visible change evidence |
Problem
Related issue: N/A
Validation tasks: none
The admin dashboard's Top titles and Most active profiles widgets count every playback stop as a play. Someone who watches a film in ten short sittings shows ten plays for it, and a film they gave up on after a few minutes still ranks. The widgets are meant to show what people watch, so titles watched in many short sittings push out ones people actually finished. A user reported this on Discord. This change counts only finished plays.
Every playback stop past the 5% minimum-resume threshold writes a
user_watch_historyrow, markedcompletedonly past the watched threshold (90% by default). The leaderboard queries counted everyplaybackrow. Per-item play counts (the Plays sort, episode play counts, JellyfinPlayCount) already count completed rows only.Approach
Both leaderboard queries now count completed rows, through the filter that already left out marked-as-watched rows. A play on the dashboard now means the same thing as everywhere else in Silo: the profile reached the watched threshold. Watch time (
total_seconds) still sums every sitting, so time spent on unfinished titles is still shown.docs/admin-api.mddescribes the new meaning ofplays.Merging consecutive sittings into one play would still credit unfinished watches, but it needs a gap setting to decide when one viewing ends. Counting finished plays is simpler and matches the rest of Silo.
This is a server-only change. The widget label "plays" still fits, so the web client is unchanged. The Apple and Android apps do not call this endpoint, Jellyfin has no equivalent leaderboard, and the user manual does not describe these widgets.
Validation
main's query (4 and 2 plays) and passes with the fix.main) and after (this branch): see Evidence.lint-changed,lint-router-recovery, route inventory, API v2 OpenAPI and contract, local paths, size ratchet, bidi, and v1 route freeze checks pass.make test-gofailed ininternal/cacheandinternal/historyimportwhile a sandbox image build was loading the same host. Neither package is touched here, and both pass when rerun on this branch and onmain.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3388/
Surface and build: web admin dashboard at desktop and phone width. Before is
mainat 81ae2ce, after is this branch, same sandbox and data. Ten 5-minute sittings of a 50-minute title go from 10 plays to 1 play. Watch time is unchanged.Risks
A title nobody finished in the window no longer appears in Top titles, and a profile that starts many titles but rarely finishes one ranks lower in Most active profiles. The
playsfield keeps its name and type, and its meaning narrows to finished plays. No migration.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Fix admin leaderboards to count only completed plays
Fixes the admin top-activity leaderboards so that a "play" counts only history rows marked completed, from either
playbackorlegacysources. Previously theadminTopActivityPlayFilterpredicate allowed any row from those sources, so unfinished sittings inflated the title and profile play counts. Time from finalized sessions still counts towardtotal_seconds, and mark rows remain excluded.TestAdminTopActivityCountsFinishedPlaybackwith fixtures covering resumed and abandoned sittings, and re-registers it in the DB contract list db-contracts.txtplaysdefinition in the admin API docs admin-api.mdadminTopActivityPlayFilterin admin_stats_top.go to review the completed-row conditionMacroscope summarized 5504cf9.