From 6ce463b529ecc3b431d145056143e18c7fa1a68a Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Sat, 23 Sep 2023 00:11:53 -0400 Subject: [PATCH] Add player names to tournament query --- cli/src/queries/tournament_sets.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cli/src/queries/tournament_sets.rs b/cli/src/queries/tournament_sets.rs index ebe42d3..acaf413 100644 --- a/cli/src/queries/tournament_sets.rs +++ b/cli/src/queries/tournament_sets.rs @@ -91,6 +91,8 @@ struct Participant { #[derive(cynic::QueryFragment, Debug)] struct Player { id: Option, + gamer_tag: Option, + prefix: Option, } // Unwrap @@ -105,6 +107,12 @@ pub struct SetData { pub winner: usize, } +pub struct PlayerData { + pub id: PlayerId, + pub gamer_tag: Option, + pub prefix: Option, +} + impl<'a> QueryUnwrap> for TournamentSets { type Unwrapped = Vec; @@ -142,7 +150,14 @@ impl<'a> QueryUnwrap> for TournamentSets { slot.entrant? .participants .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()?;