Fix wishlist download UI showing status on wrong track rows
Stamp _original_index on tracks before submitting to download processor so task indices match frontend modal row order. Sanitization and filtering could reorder tracks, causing the backend to assign indices that didn't match the displayed rows. Visual-only fix — actual downloads were always correct.
This commit is contained in:
parent
81da57f306
commit
81852caa59
1 changed files with 12 additions and 1 deletions
|
|
@ -18489,8 +18489,10 @@ def _process_wishlist_automatically(automation_id=None):
|
|||
wishlist_auto_processing_timestamp = 0
|
||||
return
|
||||
|
||||
# Use filtered tracks for processing
|
||||
# Use filtered tracks for processing — stamp original index
|
||||
wishlist_tracks = filtered_tracks
|
||||
for i, track in enumerate(wishlist_tracks):
|
||||
track['_original_index'] = i
|
||||
|
||||
# Create batch for automatic processing
|
||||
batch_id = str(uuid.uuid4())
|
||||
|
|
@ -19311,6 +19313,10 @@ def start_wishlist_missing_downloads():
|
|||
wishlist_tracks = filtered_tracks
|
||||
print(f"🔍 [Manual-Wishlist] Filtered to {len(wishlist_tracks)} tracks for category: {category}")
|
||||
|
||||
# Stamp original index on each track so task indices match frontend row order
|
||||
for i, track in enumerate(wishlist_tracks):
|
||||
track['_original_index'] = i
|
||||
|
||||
# Add activity for wishlist download start
|
||||
add_activity_item("📥", "Wishlist Download Started", f"{len(wishlist_tracks)} tracks", "Now")
|
||||
|
||||
|
|
@ -24924,6 +24930,11 @@ def start_missing_tracks_process(playlist_id):
|
|||
deezer_discovery_states[deezer_playlist_id]['converted_spotify_playlist_id'] = playlist_id
|
||||
print(f"🔗 Linked Deezer playlist {deezer_playlist_id} to download process {batch_id} (converted ID: {playlist_id})")
|
||||
|
||||
# Stamp original index to keep task indices aligned with frontend row order
|
||||
for i, track in enumerate(tracks):
|
||||
if '_original_index' not in track:
|
||||
track['_original_index'] = i
|
||||
|
||||
missing_download_executor.submit(_run_full_missing_tracks_process, batch_id, playlist_id, tracks)
|
||||
|
||||
return jsonify({
|
||||
|
|
|
|||
Loading…
Reference in a new issue