From e8e353192c97b32396acd830e08de28d365034f0 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 29 Aug 2022 22:06:21 +0200 Subject: show only completed matches in match log --- planetwars-server/src/db/matches.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'planetwars-server/src/db/matches.rs') diff --git a/planetwars-server/src/db/matches.rs b/planetwars-server/src/db/matches.rs index 86939be..2041296 100644 --- a/planetwars-server/src/db/matches.rs +++ b/planetwars-server/src/db/matches.rs @@ -141,6 +141,7 @@ fn fetch_full_match_data( pub fn list_matches(amount: i64, conn: &PgConnection) -> QueryResult> { conn.transaction(|| { let matches = matches::table + .filter(matches::state.eq(MatchState::Finished)) .order_by(matches::created_at.desc()) .limit(amount) .get_results::(conn)?; @@ -158,6 +159,7 @@ pub fn list_public_matches( conn.transaction(|| { // TODO: how can this common logic be abstracted? let query = matches::table + .filter(matches::state.eq(MatchState::Finished)) .filter(matches::is_public.eq(true)) .into_boxed(); @@ -175,6 +177,7 @@ pub fn list_bot_matches( conn: &PgConnection, ) -> QueryResult> { let query = matches::table + .filter(matches::state.eq(MatchState::Finished)) .filter(matches::is_public.eq(true)) .order_by(matches::created_at.desc()) .inner_join(match_players::table) -- cgit v1.2.3