diff options
Diffstat (limited to 'planetwars-server/src/modules/ranking.rs')
-rw-r--r-- | planetwars-server/src/modules/ranking.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/planetwars-server/src/modules/ranking.rs b/planetwars-server/src/modules/ranking.rs index 751c35e..3182ce2 100644 --- a/planetwars-server/src/modules/ranking.rs +++ b/planetwars-server/src/modules/ranking.rs @@ -37,18 +37,14 @@ pub async fn run_ranker(db_pool: DbPool) { async fn play_ranking_match(selected_bots: Vec<Bot>, db_pool: DbPool) { let db_conn = db_pool.get().await.expect("could not get db pool"); - let mut code_bundles = Vec::new(); + let mut players = Vec::new(); for bot in &selected_bots { - let code_bundle = db::bots::active_bot_version(bot.id, &db_conn) - .expect("could not get active code bundle"); - code_bundles.push(code_bundle); + let version = db::bots::active_bot_version(bot.id, &db_conn) + .expect("could not get active bot version"); + let player = MatchPlayer::from_bot_version(bot, &version); + players.push(player); } - let players = code_bundles - .iter() - .map(MatchPlayer::from_code_bundle) - .collect::<Vec<_>>(); - let mut run_match = RunMatch::from_players(players); run_match .store_in_database(&db_conn) |