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.
This commit is contained in:
Kiana Sheibani 2023-09-02 18:55:10 -04:00
parent 1d870362b5
commit 6287c325ef
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -23,7 +23,7 @@ pub struct TournamentSets {
#[arguments(query: { #[arguments(query: {
page: 1, page: 1,
perPage: 1, perPage: 1,
sortBy: "startAt desc", sortBy: "endAt desc",
filter: { filter: {
past: true, past: true,
afterDate: $last_query, afterDate: $last_query,
@ -144,16 +144,14 @@ impl<'a> QueryUnwrap<TournamentSetsVars<'a>> for TournamentSets {
let teams = set let teams = set
.slots .slots
.into_iter() .into_iter()
.filter_map(|slot| { .map(|slot| {
Some(
slot.entrant? slot.entrant?
.participants .participants
.into_iter() .into_iter()
.filter_map(|p| Some(p.player?.id?)) .map(|p| p.player?.id)
.collect(), .try_collect()
)
}) })
.collect(); .try_collect()?;
Some(SetResponse { teams, winner }) Some(SetResponse { teams, winner })
}) })
.collect::<Vec<_>>(), .collect::<Vec<_>>(),