diff options
Diffstat (limited to 'planetwars-server/src/modules')
-rw-r--r-- | planetwars-server/src/modules/bot_api.rs | 2 | ||||
-rw-r--r-- | planetwars-server/src/modules/bots.rs | 2 | ||||
-rw-r--r-- | planetwars-server/src/modules/matches.rs | 4 | ||||
-rw-r--r-- | planetwars-server/src/modules/ranking.rs | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/planetwars-server/src/modules/bot_api.rs b/planetwars-server/src/modules/bot_api.rs index 0ecbf71..6324010 100644 --- a/planetwars-server/src/modules/bot_api.rs +++ b/planetwars-server/src/modules/bot_api.rs @@ -104,7 +104,7 @@ impl pb::bot_api_service_server::BotApiService for BotApiServer { let opponent = db::bots::find_bot_by_name(&match_request.opponent_name, &conn) .map_err(|_| Status::not_found("opponent not found"))?; - let opponent_code_bundle = db::bots::active_code_bundle(opponent.id, &conn) + let opponent_code_bundle = db::bots::active_bot_version(opponent.id, &conn) .map_err(|_| Status::not_found("opponent has no code"))?; let player_key = gen_alphanumeric(32); diff --git a/planetwars-server/src/modules/bots.rs b/planetwars-server/src/modules/bots.rs index ddc1589..cd26ee0 100644 --- a/planetwars-server/src/modules/bots.rs +++ b/planetwars-server/src/modules/bots.rs @@ -8,7 +8,7 @@ pub fn save_code_bundle( bot_code: &str, bot_id: Option<i32>, conn: &PgConnection, -) -> QueryResult<db::bots::CodeBundle> { +) -> QueryResult<db::bots::BotVersion> { let bundle_name = gen_alphanumeric(16); let code_bundle_dir = PathBuf::from(BOTS_DIR).join(&bundle_name); diff --git a/planetwars-server/src/modules/matches.rs b/planetwars-server/src/modules/matches.rs index 7d6a1dc..4a5a980 100644 --- a/planetwars-server/src/modules/matches.rs +++ b/planetwars-server/src/modules/matches.rs @@ -29,7 +29,7 @@ pub struct MatchPlayer { } impl MatchPlayer { - pub fn from_code_bundle(code_bundle: &db::bots::CodeBundle) -> Self { + pub fn from_code_bundle(code_bundle: &db::bots::BotVersion) -> Self { MatchPlayer { bot_spec: code_bundle_to_botspec(code_bundle), code_bundle_id: Some(code_bundle.id), @@ -97,7 +97,7 @@ impl RunMatch { } } -pub fn code_bundle_to_botspec(code_bundle: &db::bots::CodeBundle) -> Box<dyn BotSpec> { +pub fn code_bundle_to_botspec(code_bundle: &db::bots::BotVersion) -> Box<dyn BotSpec> { // TODO: get rid of this unwrap let bundle_path = PathBuf::from(BOTS_DIR).join(code_bundle.code_bundle_path.as_ref().unwrap()); diff --git a/planetwars-server/src/modules/ranking.rs b/planetwars-server/src/modules/ranking.rs index b1ad0da..751c35e 100644 --- a/planetwars-server/src/modules/ranking.rs +++ b/planetwars-server/src/modules/ranking.rs @@ -39,7 +39,7 @@ 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(); for bot in &selected_bots { - let code_bundle = db::bots::active_code_bundle(bot.id, &db_conn) + let code_bundle = db::bots::active_bot_version(bot.id, &db_conn) .expect("could not get active code bundle"); code_bundles.push(code_bundle); } |