Fix admin dashboard to show total playable tracks (local + external matched)

This commit is contained in:
2026-02-04 23:16:56 -05:00
parent 4b289e4ddd
commit 72b1584d51
2 changed files with 12 additions and 8 deletions

View File

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

View File

@@ -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 = `<span class="track-count">${spotifyTotal}</span>`;
// Build detailed stats string - show total playable tracks prominently
let statsHtml = `<span class="track-count">${totalPlayable}/${spotifyTotal}</span>`;
// Show breakdown with color coding
let breakdownParts = [];
@@ -1207,8 +1209,8 @@
? `<br><small style="color:var(--text-secondary)">${breakdownParts.join(' • ')}</small>`
: '';
// 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;