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:
parent
1d870362b5
commit
6287c325ef
|
@ -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<_>>(),
|
||||||
|
|
Loading…
Reference in a new issue