aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/modules/bot_api.rs
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-07-23 23:40:25 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-07-23 23:40:25 +0200
commit4a582e8079178a7ac11f2a492e7988fcdaa210cd (patch)
tree1403b3e409e184bb53e0349d7e68e673fe7d7b3c /planetwars-server/src/modules/bot_api.rs
parentf19a70e710b8bf4605625516aa7e4c0cc7ace2e4 (diff)
downloadplanetwars.dev-4a582e8079178a7ac11f2a492e7988fcdaa210cd.tar.xz
planetwars.dev-4a582e8079178a7ac11f2a492e7988fcdaa210cd.zip
store active version id in bots table
Diffstat (limited to 'planetwars-server/src/modules/bot_api.rs')
-rw-r--r--planetwars-server/src/modules/bot_api.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/planetwars-server/src/modules/bot_api.rs b/planetwars-server/src/modules/bot_api.rs
index 3bc002c..3efb1c2 100644
--- a/planetwars-server/src/modules/bot_api.rs
+++ b/planetwars-server/src/modules/bot_api.rs
@@ -104,10 +104,9 @@ impl pb::bot_api_service_server::BotApiService for BotApiServer {
let match_request = req.get_ref();
- let opponent_bot = db::bots::find_bot_by_name(&match_request.opponent_name, &conn)
- .map_err(|_| Status::not_found("opponent not found"))?;
- let opponent_bot_version = db::bots::active_bot_version(opponent_bot.id, &conn)
- .map_err(|_| Status::not_found("no opponent version found"))?;
+ let (opponent_bot, opponent_bot_version) =
+ db::bots::find_bot_with_version_by_name(&match_request.opponent_name, &conn)
+ .map_err(|_| Status::not_found("opponent not found"))?;
let player_key = gen_alphanumeric(32);