From 72b1584d511f93131ee222c3f1221c08fe9bd798 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Wed, 4 Feb 2026 23:16:56 -0500 Subject: [PATCH] Fix admin dashboard to show total playable tracks (local + external matched) --- allstarr/Controllers/AdminController.cs | 10 ++++++---- allstarr/wwwroot/index.html | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index 810fc34..e9a35fc 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -301,9 +301,10 @@ public class AdminController : ControllerBase playlistInfo["externalMissing"] = externalMissingCount; playlistInfo["externalTotal"] = externalCount + externalMissingCount; playlistInfo["totalInJellyfin"] = cachedPlaylistItems.Count; + playlistInfo["totalPlayable"] = localCount + externalCount; // Total tracks that will be served - _logger.LogInformation("Playlist {Name} (from cache): {Total} Spotify tracks, {Local} local, {ExtMatched} external matched, {ExtMissing} external missing", - config.Name, spotifyTracks.Count, localCount, externalCount, externalMissingCount); + _logger.LogInformation("Playlist {Name} (from cache): {Total} Spotify tracks, {Local} local, {ExtMatched} external matched, {ExtMissing} external missing, {Playable} total playable", + config.Name, spotifyTracks.Count, localCount, externalCount, externalMissingCount, localCount + externalCount); } else { @@ -394,9 +395,10 @@ public class AdminController : ControllerBase playlistInfo["externalMissing"] = externalMissingCount; playlistInfo["externalTotal"] = externalMatchedCount + externalMissingCount; playlistInfo["totalInJellyfin"] = localCount + externalMatchedCount; + playlistInfo["totalPlayable"] = localCount + externalMatchedCount; // Total tracks that will be served - _logger.LogDebug("Playlist {Name} (fallback): {Total} Spotify tracks, {Local} local, {ExtMatched} external matched, {ExtMissing} external missing", - config.Name, spotifyTracks.Count, localCount, externalMatchedCount, externalMissingCount); + _logger.LogDebug("Playlist {Name} (fallback): {Total} Spotify tracks, {Local} local, {ExtMatched} external matched, {ExtMissing} external missing, {Playable} total playable", + config.Name, spotifyTracks.Count, localCount, externalMatchedCount, externalMissingCount, localCount + externalMatchedCount); } } else diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index f7163f1..d456879 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -1177,6 +1177,7 @@ const externalMatched = p.externalMatched || 0; const externalMissing = p.externalMissing || 0; const totalInJellyfin = p.totalInJellyfin || 0; + const totalPlayable = p.totalPlayable || (localCount + externalMatched); // Total tracks that will be served // Debug: Log the raw data console.log(`Playlist ${p.name}:`, { @@ -1185,11 +1186,12 @@ externalMatched, externalMissing, totalInJellyfin, + totalPlayable, rawData: p }); - // Build detailed stats string - let statsHtml = `${spotifyTotal}`; + // Build detailed stats string - show total playable tracks prominently + let statsHtml = `${totalPlayable}/${spotifyTotal}`; // Show breakdown with color coding let breakdownParts = []; @@ -1207,8 +1209,8 @@ ? `
${breakdownParts.join(' • ')}` : ''; - // Calculate completion percentage - const completionPct = spotifyTotal > 0 ? Math.round((totalInJellyfin / spotifyTotal) * 100) : 0; + // Calculate completion percentage based on playable tracks + const completionPct = spotifyTotal > 0 ? Math.round((totalPlayable / spotifyTotal) * 100) : 0; const localPct = spotifyTotal > 0 ? Math.round((localCount / spotifyTotal) * 100) : 0; const externalPct = spotifyTotal > 0 ? Math.round((externalMatched / spotifyTotal) * 100) : 0; const missingPct = spotifyTotal > 0 ? Math.round((externalMissing / spotifyTotal) * 100) : 0;