From 6287c325efd84d7e024178cb0c4025453f3ecec4 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sat, 2 Sep 2023 18:55:10 -0400 Subject: [PATCH] Throw out sets containing invalid players The previous code would keep these sets, but filter out the invalid players. This has been changed to discard the set entirely. --- cli/src/queries/tournament_sets.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cli/src/queries/tournament_sets.rs b/cli/src/queries/tournament_sets.rs index 99b7c95..5de16b5 100644 --- a/cli/src/queries/tournament_sets.rs +++ b/cli/src/queries/tournament_sets.rs @@ -23,7 +23,7 @@ pub struct TournamentSets { #[arguments(query: { page: 1, perPage: 1, - sortBy: "startAt desc", + sortBy: "endAt desc", filter: { past: true, afterDate: $last_query, @@ -144,16 +144,14 @@ impl<'a> QueryUnwrap> for TournamentSets { let teams = set .slots .into_iter() - .filter_map(|slot| { - Some( - slot.entrant? - .participants - .into_iter() - .filter_map(|p| Some(p.player?.id?)) - .collect(), - ) + .map(|slot| { + slot.entrant? + .participants + .into_iter() + .map(|p| p.player?.id) + .try_collect() }) - .collect(); + .try_collect()?; Some(SetResponse { teams, winner }) }) .collect::>(),