From e9010fd39de55cd6e7cb5c1c473b0439355eb710 Mon Sep 17 00:00:00 2001 From: Antoine Gersant <antoine.gersant@lesforges.org> Date: Sun, 24 Sep 2017 20:20:37 -0700 Subject: [PATCH] Fixed a bug where playlists were overwriting each other --- src/playlist.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/playlist.rs b/src/playlist.rs index 691a843..632d682 100644 --- a/src/playlist.rs +++ b/src/playlist.rs @@ -74,7 +74,7 @@ pub fn list_playlists<T>(owner: &str, db: &T) -> Result<Vec<String>> } } -pub fn save_playlist<T>(name: &str, owner: &str, content: &Vec<String>, db: &T) -> Result<()> +pub fn save_playlist<T>(playlist_name: &str, owner: &str, content: &Vec<String>, db: &T) -> Result<()> where T: ConnectionSource + VFSSource { let user: User; @@ -96,7 +96,7 @@ pub fn save_playlist<T>(name: &str, owner: &str, content: &Vec<String>, db: &T) // Create playlist new_playlist = NewPlaylist { - name: name.into(), + name: playlist_name.into(), owner: user.id, }; @@ -107,7 +107,7 @@ pub fn save_playlist<T>(name: &str, owner: &str, content: &Vec<String>, db: &T) { use self::playlists::dsl::*; playlist = playlists - .filter(name.eq(name).and(owner.eq(user.id))) + .filter(name.eq(playlist_name).and(owner.eq(user.id))) .get_result(connection.deref())?; } }