Update note row number in db when it changes
This commit is contained in:
parent
fe4b1f8b5e
commit
79e1fdde27
@ -165,7 +165,7 @@ class Notes(Base):
|
||||
ERROR(f"get_track({note_id}): not found")
|
||||
return None
|
||||
|
||||
def update_note(
|
||||
def update(
|
||||
self, session: Session, row: int,
|
||||
text: Optional[str] = None) -> None:
|
||||
"""
|
||||
|
||||
@ -529,6 +529,9 @@ class PlaylistTab(QTableWidget):
|
||||
note: Notes = self._get_row_notes_object(row, session)
|
||||
session.add(note)
|
||||
playlist_notes[note.id] = note
|
||||
if row != note.row:
|
||||
DEBUG(f"Updating: {playlist.name=}, {row=}, {note.row=}")
|
||||
note.update(session=session, row=row)
|
||||
|
||||
# Database
|
||||
for note in playlist.notes:
|
||||
@ -554,7 +557,7 @@ class PlaylistTab(QTableWidget):
|
||||
f"from {database_notes[note_id]=} "
|
||||
f"to {playlist_notes[note_id]=}"
|
||||
)
|
||||
database_notes[note_id].update_note(
|
||||
database_notes[note_id].update(
|
||||
session, row=playlist_notes[note_id].row)
|
||||
|
||||
# Tracks
|
||||
@ -915,9 +918,8 @@ class PlaylistTab(QTableWidget):
|
||||
with Session() as session:
|
||||
if row in self._get_notes_rows():
|
||||
# Save change to database
|
||||
DEBUG(f"Notes.update_note: saving new note text '{new_text=}'")
|
||||
note: Notes = self._get_row_notes_object(row, session)
|
||||
note.update_note(session, row, new_text)
|
||||
note.update(session, row, new_text)
|
||||
# Set/clear row start time accordingly
|
||||
start_time = self._get_note_text_time(new_text)
|
||||
if start_time:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user