Add player names to tournament query
This commit is contained in:
parent
fe4f82daeb
commit
6ce463b529
|
@ -91,6 +91,8 @@ struct Participant {
|
||||||
#[derive(cynic::QueryFragment, Debug)]
|
#[derive(cynic::QueryFragment, Debug)]
|
||||||
struct Player {
|
struct Player {
|
||||||
id: Option<PlayerId>,
|
id: Option<PlayerId>,
|
||||||
|
gamer_tag: Option<String>,
|
||||||
|
prefix: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unwrap
|
// Unwrap
|
||||||
|
@ -105,6 +107,12 @@ pub struct SetData {
|
||||||
pub winner: usize,
|
pub winner: usize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct PlayerData {
|
||||||
|
pub id: PlayerId,
|
||||||
|
pub gamer_tag: Option<String>,
|
||||||
|
pub prefix: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
impl<'a> QueryUnwrap<TournamentSetsVars<'a>> for TournamentSets {
|
impl<'a> QueryUnwrap<TournamentSetsVars<'a>> for TournamentSets {
|
||||||
type Unwrapped = Vec<TournamentData>;
|
type Unwrapped = Vec<TournamentData>;
|
||||||
|
|
||||||
|
@ -142,7 +150,14 @@ impl<'a> QueryUnwrap<TournamentSetsVars<'a>> for TournamentSets {
|
||||||
slot.entrant?
|
slot.entrant?
|
||||||
.participants
|
.participants
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|p| p.player?.id)
|
.map(|p| {
|
||||||
|
let p_ = p.player?;
|
||||||
|
Some(PlayerData {
|
||||||
|
id: p_.id?,
|
||||||
|
gamer_tag: p_.gamer_tag,
|
||||||
|
prefix: p_.prefix,
|
||||||
|
})
|
||||||
|
})
|
||||||
.try_collect()
|
.try_collect()
|
||||||
})
|
})
|
||||||
.try_collect()?;
|
.try_collect()?;
|
||||||
|
|
Loading…
Reference in a new issue