Discography UI: show WHY tracks were skipped, not a flat "No new tracks" (#830)
The per-album status only looked at added + the generic wishlist-skip count, so anything else (other-artist credit, already owned, content-filtered) showed the misleading "No new tracks" — which is what made Vicky-2418's artist-mismatch skips look like "you already have it." The backend already streams the full breakdown (tracks_skipped_artist/owned/filter); the UI just ignored it. New shared _discogItemStatus(data) builds an accurate line from all the counts: "4 by other artists", "13 already owned", "1 added, 2 already owned", etc. Replaces the duplicated 4-line block at both render sites. Frontend only; JS syntax + per-case output verified.
This commit is contained in:
parent
db65e783c7
commit
ca040d2c10
1 changed files with 18 additions and 8 deletions
|
|
@ -2794,10 +2794,7 @@ async function startDiscographyDownload() {
|
|||
item.classList.remove('active');
|
||||
|
||||
if (data.status === 'done') {
|
||||
const parts = [];
|
||||
if (data.tracks_added > 0) parts.push(`${data.tracks_added} added`);
|
||||
if (data.tracks_skipped > 0) parts.push(`${data.tracks_skipped} skipped`);
|
||||
statusEl.textContent = parts.join(', ') || 'No new tracks';
|
||||
statusEl.textContent = _discogItemStatus(data);
|
||||
iconEl.innerHTML = data.tracks_added > 0 ? '<span class="discog-check">✓</span>' : '<span class="discog-skip">—</span>';
|
||||
item.classList.add(data.tracks_added > 0 ? 'done' : 'skipped');
|
||||
} else if (data.status === 'error') {
|
||||
|
|
@ -2814,6 +2811,22 @@ async function startDiscographyDownload() {
|
|||
}
|
||||
}
|
||||
|
||||
// Build a clear per-album status from the discography stream payload. The
|
||||
// backend already reports WHY tracks weren't added — other-artist credit,
|
||||
// already owned/queued, or content-filtered — so surface that instead of a
|
||||
// misleading "No new tracks" (#830: collab tracks dropped for "artist mismatch"
|
||||
// looked identical to "you already have it").
|
||||
function _discogItemStatus(data) {
|
||||
const parts = [];
|
||||
const added = data.tracks_added || 0;
|
||||
if (added > 0) parts.push(`${added} added`);
|
||||
if ((data.tracks_skipped_owned || 0) > 0) parts.push(`${data.tracks_skipped_owned} already owned`);
|
||||
if ((data.tracks_skipped || 0) > 0) parts.push(`${data.tracks_skipped} already queued`);
|
||||
if ((data.tracks_skipped_artist || 0) > 0) parts.push(`${data.tracks_skipped_artist} by other artists`);
|
||||
if ((data.tracks_skipped_filter || 0) > 0) parts.push(`${data.tracks_skipped_filter} filtered out`);
|
||||
return parts.join(', ') || 'No tracks';
|
||||
}
|
||||
|
||||
function _handleDiscogProgress(data) {
|
||||
if (data.type === 'album') {
|
||||
const item = document.getElementById(`discog-prog-${data.album_id}`);
|
||||
|
|
@ -2826,10 +2839,7 @@ function _handleDiscogProgress(data) {
|
|||
statusEl.textContent = `Processing ${data.tracks_total} tracks...`;
|
||||
item.classList.add('active');
|
||||
} else if (data.status === 'done') {
|
||||
const parts = [];
|
||||
if (data.tracks_added > 0) parts.push(`${data.tracks_added} added`);
|
||||
if (data.tracks_skipped > 0) parts.push(`${data.tracks_skipped} skipped`);
|
||||
statusEl.textContent = parts.join(', ') || 'No new tracks';
|
||||
statusEl.textContent = _discogItemStatus(data);
|
||||
iconEl.innerHTML = data.tracks_added > 0 ? '<span class="discog-check">✓</span>' : '<span class="discog-skip">—</span>';
|
||||
item.classList.remove('active');
|
||||
item.classList.add(data.tracks_added > 0 ? 'done' : 'skipped');
|
||||
|
|
|
|||
Loading…
Reference in a new issue