aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/db/ratings.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-10-12 22:52:15 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-10-12 22:52:15 +0200
commitae57359353cf31ff374a8932999742920878bf00 (patch)
tree0db27d394a2a61a5cc94e73014c82954829c1338 /planetwars-server/src/db/ratings.rs
parented016773b112460ebbf0ff023b0915545229ed41 (diff)
downloadplanetwars.dev-ae57359353cf31ff374a8932999742920878bf00.tar.xz
planetwars.dev-ae57359353cf31ff374a8932999742920878bf00.zip
upgrade to diesel 2.0
Diffstat (limited to 'planetwars-server/src/db/ratings.rs')
-rw-r--r--planetwars-server/src/db/ratings.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/planetwars-server/src/db/ratings.rs b/planetwars-server/src/db/ratings.rs
index 8262fed..0a510d4 100644
--- a/planetwars-server/src/db/ratings.rs
+++ b/planetwars-server/src/db/ratings.rs
@@ -10,7 +10,7 @@ pub struct Rating {
pub rating: f64,
}
-pub fn get_rating(bot_id: i32, db_conn: &PgConnection) -> QueryResult<Option<f64>> {
+pub fn get_rating(bot_id: i32, db_conn: &mut PgConnection) -> QueryResult<Option<f64>> {
ratings::table
.filter(ratings::bot_id.eq(bot_id))
.select(ratings::rating)
@@ -18,7 +18,7 @@ pub fn get_rating(bot_id: i32, db_conn: &PgConnection) -> QueryResult<Option<f64
.optional()
}
-pub fn set_rating(bot_id: i32, rating: f64, db_conn: &PgConnection) -> QueryResult<usize> {
+pub fn set_rating(bot_id: i32, rating: f64, db_conn: &mut PgConnection) -> QueryResult<usize> {
diesel::insert_into(ratings::table)
.values(Rating { bot_id, rating })
.on_conflict(ratings::bot_id)
@@ -40,7 +40,7 @@ pub struct RankedBot {
pub rating: f64,
}
-pub fn get_bot_ranking(db_conn: &PgConnection) -> QueryResult<Vec<RankedBot>> {
+pub fn get_bot_ranking(db_conn: &mut PgConnection) -> QueryResult<Vec<RankedBot>> {
bots::table
.left_join(users::table)
.inner_join(ratings::table)