summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDennis Kobert <dennis@kobert.dev>2020-02-11 21:47:40 +0000
committerDennis Kobert <dennis@kobert.dev>2020-02-11 21:47:40 +0000
commitb9606de0d8801f37edb289ad3733b96e557dea3e (patch)
tree0deae6e1b2cef7ec66ce318111deb60da904a5af /src
parentf4a5e3ac53e854065a3999828a176024cead3807 (diff)
Fix result query
Diffstat (limited to 'src')
-rw-r--r--src/serve.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/serve.rs b/src/serve.rs
index 7c15b03..bc13b86 100644
--- a/src/serve.rs
+++ b/src/serve.rs
@@ -34,6 +34,9 @@ pub fn get_tracks(name: String, url: String) -> String {
)
.unwrap();
let uid = get_uid(user_id.as_ref(), &mut client);
+ client
+ .execute("DELETE FROM user_track WHERE user_id = $1;", &[&uid])
+ .unwrap();
drop(client);
let chunk_size = 50;
let mut playlist_index = 0;
@@ -184,10 +187,11 @@ pub fn match_users(name1: String, name2: String) -> Result<String, status::Custo
let tid: i32 = row.get(0);
let song = &client
.query(
- "SELECT name artist popularity FROM track where track_id = $1",
+ "SELECT name, artist FROM track where track_id = $1",
&[&tid],
)
.unwrap()[0];
+ println!("{:?}", song.columns());
let name: String = song.get(0);
let artist: String = song.get(1);
songs = format!("{}{} by {}\n", songs, name, artist);