summaryrefslogtreecommitdiff
path: root/src/serve.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/serve.rs')
-rw-r--r--src/serve.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/serve.rs b/src/serve.rs
index d2794f8..95ce9b1 100644
--- a/src/serve.rs
+++ b/src/serve.rs
@@ -204,9 +204,8 @@ pub fn match_users(name1: String, name2: String) -> Result<String, status::NotFo
($1), ($2)
- ) AS _ (user_name)
+ ) AS _ (user_id)
)
- --SELECT track_id, SUM(score) / (SELECT COUNT(*) FROM users) AS score
SELECT track_id, name, artist
FROM track
JOIN (
@@ -214,14 +213,14 @@ pub fn match_users(name1: String, name2: String) -> Result<String, status::NotFo
FROM user_track
JOIN suser USING (user_id)
JOIN track USING (track_id)
- WHERE suser.user_name IN (SELECT * FROM users)
+ WHERE suser.user_id IN (SELECT * FROM users)
GROUP BY track_id
HAVING COUNT(track_id) = (SELECT COUNT(*) FROM users)
ORDER BY SUM(score) DESC
) AS _ USING (track_id)
;
",
- &[name1.as_ref(), name2.as_ref()],
+ &[&uid1, &uid2],
)
.unwrap()
{