From 1eb81092d7a3e7925ae8e4258aa35a009f911b6e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 22 Nov 2022 20:42:34 +0100 Subject: add is_ranked attribute to matches --- planetwars-server/src/db/matches.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (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 2aff44b..7af5b4d 100644 --- a/planetwars-server/src/db/matches.rs +++ b/planetwars-server/src/db/matches.rs @@ -140,12 +140,15 @@ fn fetch_full_match_data( } // TODO: this method should disappear -pub fn list_matches(amount: i64, conn: &mut PgConnection) -> QueryResult> { +pub fn fetch_ranked_maps(amount: i64, conn: &mut PgConnection) -> QueryResult> { conn.transaction(|conn| { let matches = matches::table + .inner_join(maps::table) .filter(matches::state.eq(MatchState::Finished)) + .filter(maps::is_ranked.eq(true)) .order_by(matches::created_at.desc()) .limit(amount) + .select(matches::all_columns) .get_results::(conn)?; fetch_full_match_data(matches, conn) -- cgit v1.2.3