diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-23 14:47:24 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-07-23 14:47:24 +0200 |
commit | f19a70e710b8bf4605625516aa7e4c0cc7ace2e4 (patch) | |
tree | 768aa3c43df72cdae81cda4699c81867579a97c2 /planetwars-server/src/db/matches.rs | |
parent | 5e560b23f8305c3a700ef722ea3ba278bc30fbca (diff) | |
download | planetwars.dev-f19a70e710b8bf4605625516aa7e4c0cc7ace2e4.tar.xz planetwars.dev-f19a70e710b8bf4605625516aa7e4c0cc7ace2e4.zip |
sort match players to ensure correct ordering
Diffstat (limited to 'planetwars-server/src/db/matches.rs')
-rw-r--r-- | planetwars-server/src/db/matches.rs | 5 |
1 files changed, 5 insertions, 0 deletions
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<Vec<FullMatchData>> { .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::<FullMatchPlayerData>(conn)? .grouped_by(&matches); @@ -150,6 +154,7 @@ pub fn find_match(id: i32, conn: &PgConnection) -> QueryResult<FullMatchData> { .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::<FullMatchPlayerData>(conn)?; let res = FullMatchData { |