diff options
author | Dennis Kobert <dennis@kobert.dev> | 2021-10-10 18:03:49 +0000 |
---|---|---|
committer | Dennis Kobert <dennis@kobert.dev> | 2021-10-10 18:03:49 +0000 |
commit | cea354fc5e32667786c4a4c9f379b46b3de87ec4 (patch) | |
tree | a492a32e58b82c10b939be097821fd18d3f52a2f /src | |
parent | a3dda94db49570f7f1e6484b49bca9196c317493 (diff) |
Change deploymentback
Diffstat (limited to 'src')
-rw-r--r-- | src/database.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.rs b/src/database.rs index 7b548de..e7b6f7f 100644 --- a/src/database.rs +++ b/src/database.rs @@ -136,7 +136,7 @@ async fn get_uid(name: &str, lobby: &str, client: &Client) -> Result<i32, Error> pub async fn match_users(lobby: String, names: &[&str]) -> Result<String, Error> { let client = &CLIENT; let mut songs = String::new(); - let names: Vec<String> = names.iter().map(|x| x.to_string()).collect(); + let names: Vec<String> = names.iter().map(|x| x.trim().to_string()).collect(); //let users: Vec<&str> = names.iter().map(|x| x.as_str()).collect(); //println!("users to match: {:?}", users); let placeholders = @@ -159,7 +159,7 @@ pub async fn match_users(lobby: String, names: &[&str]) -> Result<String, Error> WHERE suser.user_name IN (SELECT * FROM users) AND token = $1 GROUP BY track_id HAVING COUNT(track_id) = (SELECT COUNT(*) FROM users) - ORDER BY SUM(score) DESC + ORDER BY EXP(SUM(LN(score))) DESC ) AS _ USING (track_id) ; ", @@ -170,7 +170,7 @@ pub async fn match_users(lobby: String, names: &[&str]) -> Result<String, Error> println!("{:?}", values); use futures::{pin_mut, TryStreamExt}; - let mut it = client.query_raw(query.as_str(), values).await?; + let it = client.query_raw(query.as_str(), values).await?; pin_mut!(it); while let Some(row) = it.try_next().await? { let name: String = row.get(1); |