db: Fix Playlist.get_track_index()

We need to limit the OVER () clause to just pick tracks that are
actually on the requested playlist.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2021-11-26 17:24:04 -05:00
parent b4daf0e48c
commit 6913cf992d
1 changed files with 3 additions and 2 deletions

View File

@ -53,8 +53,9 @@ class Playlist(GObject.GObject):
f"FROM tracks "
f"INNER JOIN artists USING(artistid) "
f"INNER JOIN albums USING(albumid) "
f"INNER JOIN discs USING(discid)) "
f"WHERE trackid=?", [ track.rowid ])
f"INNER JOIN discs USING(discid) "
f"WHERE tracks.{self._rowkey}=?) "
f"WHERE trackid=?", [ self.rowid, track.rowid ])
return cur.fetchone()[1] - 1
def track_adjusts_current(self, track):