From f429adb4f8607ef9b8b8e2c9fa3634c5f39a5602 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 30 Oct 2022 16:20:29 +0100 Subject: allow filtering map in bot matches --- planetwars-server/src/db/match_queries.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'planetwars-server/src/db/match_queries.rs') diff --git a/planetwars-server/src/db/match_queries.rs b/planetwars-server/src/db/match_queries.rs index f9f8140..029a657 100644 --- a/planetwars-server/src/db/match_queries.rs +++ b/planetwars-server/src/db/match_queries.rs @@ -12,6 +12,7 @@ pub struct ListBotMatches { pub outcome: Option, pub opponent_id: Option, + pub map_id: Option, // pagination options pub before: Option, @@ -55,6 +56,10 @@ impl QueryFragment for ListBotMatches { } out.push_sql(" WHERE matches.state = 'finished' AND matches.is_public = true"); + if let Some(map_id) = self.map_id.as_ref() { + out.push_sql(" AND matches.map_id = "); + out.push_bind_param::(map_id)?; + } if let Some(outcome) = self.outcome.as_ref() { match outcome { BotMatchOutcome::Win => { -- cgit v1.2.3