From f19a70e710b8bf4605625516aa7e4c0cc7ace2e4 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 23 Jul 2022 14:47:24 +0200 Subject: [PATCH] sort match players to ensure correct ordering --- planetwars-server/src/db/matches.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/planetwars-server/src/db/matches.rs b/planetwars-server/src/db/matches.rs index 6590a37..39b7d9b 100644 --- a/planetwars-server/src/db/matches.rs +++ b/planetwars-server/src/db/matches.rs @@ -97,6 +97,10 @@ pub fn list_matches(conn: &PgConnection) -> QueryResult> { .on(match_players::bot_version_id.eq(bot_versions::id.nullable())), ) .left_join(bots::table.on(bot_versions::bot_id.eq(bots::id.nullable()))) + .order_by(( + match_players::match_id.asc(), + match_players::player_id.asc(), + )) .load::(conn)? .grouped_by(&matches); @@ -150,6 +154,7 @@ pub fn find_match(id: i32, conn: &PgConnection) -> QueryResult { .on(match_players::bot_version_id.eq(bot_versions::id.nullable())), ) .left_join(bots::table.on(bot_versions::bot_id.eq(bots::id.nullable()))) + .order_by(match_players::player_id.asc()) .load::(conn)?; let res = FullMatchData {