1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-21 18:44:19 +00:00

Sort replies to matchmaking based on their choice

This commit is contained in:
Steffo 2024-08-19 09:47:20 +02:00
parent 0c6907a9da
commit c855a156f8
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
2 changed files with 2 additions and 1 deletions

View file

@ -7,7 +7,7 @@ use diesel::serialize::{IsNull, ToSql};
use super::super::schema::sql_types; use super::super::schema::sql_types;
#[derive(Debug, Clone, Copy, PartialEq, FromSqlRow, AsExpression)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, FromSqlRow, AsExpression)]
#[diesel(sql_type = sql_types::MatchmakingChoice)] #[diesel(sql_type = sql_types::MatchmakingChoice)]
pub enum MatchmakingChoice { pub enum MatchmakingChoice {
Yes, Yes,

View file

@ -33,6 +33,7 @@ impl MatchmakingReply {
.filter(matchmaking_replies::matchmaking_id.eq(matchmaking_id)) .filter(matchmaking_replies::matchmaking_id.eq(matchmaking_id))
.inner_join(users::table.on(matchmaking_replies::user_id.eq(users::id))) .inner_join(users::table.on(matchmaking_replies::user_id.eq(users::id)))
.inner_join(telegram::table.on(users::id.eq(telegram::user_id))) .inner_join(telegram::table.on(users::id.eq(telegram::user_id)))
.order_by(matchmaking_replies::choice)
.get_results::<(Self, RoyalnetUser, TelegramUser)>(database) .get_results::<(Self, RoyalnetUser, TelegramUser)>(database)
.context("Non è stato possibile recuperare le risposte al matchmaking dal database RYG.") .context("Non è stato possibile recuperare le risposte al matchmaking dal database RYG.")
} }