jakerm2002 / spotify-playlist-diff

0 stars 0 forks source link

If a track appears more than once in a playlist, it is excluded from the shared tracks endpoint #2

Closed jakerm2002 closed 1 year ago

jakerm2002 commented 1 year ago

Since the query checks the all playlists for this session, it will count the number of times a specific track id appears. If it is equal to the number of playlists, then we count it as shared. The problem is that if a specific track id appears more than once, then it will not satisfy the equal condition so it will not count as shared.

An additional bug is that if a song only appears in 1/2 playlists but the song appears twice, it will be counted as shared since (count(that song)) = 2 = # of playlists.

We can't remove duplicates entirely because we want the original playlist to show up on the website as it is.

jakerm2002 commented 1 year ago

2a1a04121d9fc16c9c37f7bfd7b6f725a1136c4 fixed the query, decided to remove duplicates, so if the same song is in the playlist more than once, and if it is sorted in track_order, then the songs will have a playlist_order value of the position of the first appearance in playlist_ids[0]