diff --git a/app/src/main/java/core/notevault/data/MusicNoteDAO.java b/app/src/main/java/core/notevault/data/MusicNoteDAO.java index 01d201e..dbd2790 100644 --- a/app/src/main/java/core/notevault/data/MusicNoteDAO.java +++ b/app/src/main/java/core/notevault/data/MusicNoteDAO.java @@ -40,8 +40,8 @@ public interface MusicNoteDAO { @Query("SELECT m.* FROM music_notes m JOIN concert_songs cs ON m.musicNoteId = cs.musicNoteID WHERE cs.id = :concertID") List getAllMusicNotesOfConcert(long concertID); - @Delete - void deleteConcertSong(ConcertSong concertSong); + @Query("DELETE FROM concert_songs WHERE concertID = :concertID AND musicNoteID = :songID") + void deleteConcertSong(long songID, int concertID); } diff --git a/app/src/main/java/core/notevault/ui/gallery/detail/ConcertDetailFragment.java b/app/src/main/java/core/notevault/ui/gallery/detail/ConcertDetailFragment.java index 91fc984..42b1895 100644 --- a/app/src/main/java/core/notevault/ui/gallery/detail/ConcertDetailFragment.java +++ b/app/src/main/java/core/notevault/ui/gallery/detail/ConcertDetailFragment.java @@ -82,6 +82,10 @@ public class ConcertDetailFragment extends Fragment { private void deleteSongFromConcert(MusicNote musicNote) { this.concertDetailViewModel.deleteConcertSong(musicNote); + new Thread(() -> { + MusicNoteDAO musicNoteDAO = MusicDatabase.getDatabase(getContext()).musicNoteDao(); + musicNoteDAO.deleteConcertSong(musicNote.getMusicNoteId(), concert.getId()); + }).start(); } private class LoadConcertSongsTask extends AsyncTask> {