From 976beade8514a435408b17251766be14741ca47b Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Tue, 10 Aug 2021 18:28:20 +0100 Subject: [PATCH] Add debug to troubleshoot issue #38 --- app/model.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/app/model.py b/app/model.py index 5c43c6d..718a138 100644 --- a/app/model.py +++ b/app/model.py @@ -317,10 +317,17 @@ class PlaylistTracks(Base): else: # Destination playlist has tracks; add to end new_row = max_row + 1 - record = session.query(PlaylistTracks).filter( - PlaylistTracks.playlist_id == from_playlist_id, - PlaylistTracks.row == row - ).one() + try: + record = session.query(PlaylistTracks).filter( + PlaylistTracks.playlist_id == from_playlist_id, + PlaylistTracks.row == row).one() + except NoResultFound: + # Issue #38? + ERROR( + f"No rows matched in query: " + f"PlaylistTracks.playlist_id == {from_playlist_id}, " + f"PlaylistTracks.row == {row}" + ) record.playlist_id = to_playlist_id record.row = new_row session.commit()