diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-08-29 22:06:21 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-08-29 22:06:21 +0200 |
commit | e8e353192c97b32396acd830e08de28d365034f0 (patch) | |
tree | 0d92e1c16da8ed3fd39a1d7575041d1cb4bf6e4f /planetwars-server/src/db/matches.rs | |
parent | c6c484daf3b083af70b50451db9409a7dec0bf24 (diff) | |
download | planetwars.dev-e8e353192c97b32396acd830e08de28d365034f0.tar.xz planetwars.dev-e8e353192c97b32396acd830e08de28d365034f0.zip |
show only completed matches in match log
Diffstat (limited to 'planetwars-server/src/db/matches.rs')
-rw-r--r-- | planetwars-server/src/db/matches.rs | 3 |
1 files changed, 3 insertions, 0 deletions
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<Vec<FullMatchData>> { conn.transaction(|| { let matches = matches::table + .filter(matches::state.eq(MatchState::Finished)) .order_by(matches::created_at.desc()) .limit(amount) .get_results::<MatchBase>(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<Vec<FullMatchData>> { 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) |