From d5d4361ec54a31c0346c9ddca9f5e723f1e9e9ea Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Fri, 10 Sep 2021 11:48:30 +0100 Subject: [PATCH] Further fixes to moving tracks between playlists Fixes: #38 --- app/model.py | 1 + app/playlists.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/app/model.py b/app/model.py index 5c75945..f47829e 100644 --- a/app/model.py +++ b/app/model.py @@ -338,6 +338,7 @@ class PlaylistTracks(Base): f"PlaylistTracks.playlist_id == {from_playlist_id}, " f"PlaylistTracks.row == {row}" ) + return record.playlist_id = to_playlist_id record.row = new_row session.commit() diff --git a/app/playlists.py b/app/playlists.py index 1dcdb5b..cec8338 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -423,6 +423,9 @@ class PlaylistTab(QTableWidget): # on its specified row, only that it will be above # larger-numbered row items, and below lower-numbered ones. + # That means we need to re-save ourself once loaded to ensure + # database is correct. + # First, save our id for the future self.id = playlist_db.id self.name = playlist_db.name @@ -449,6 +452,7 @@ class PlaylistTab(QTableWidget): scroll_to = self.item(0, self.COL_INDEX) self.scrollToItem(scroll_to, QAbstractItemView.PositionAtTop) + self._save_playlist(session) self._repaint() def repaint(self):