Workaround bug in server side

It took me SO LONG to figure out what the issue is...
This commit is contained in:
Kiana Sheibani 2023-09-02 01:41:44 -04:00
parent badcec976a
commit ce03cbcd2a
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
2 changed files with 11 additions and 8 deletions

View file

@ -36,7 +36,7 @@ fn main() {
if let Some(response) = run_query::<TournamentSets, _>( if let Some(response) = run_query::<TournamentSets, _>(
TournamentSetsVars { TournamentSetsVars {
last_query: None, last_query: Timestamp(1),
game_id: VideogameId(1386), game_id: VideogameId(1386),
country: None, country: None,
state: Some("GA"), state: Some("GA"),

View file

@ -6,9 +6,12 @@ use schema::schema;
#[derive(cynic::QueryVariables, Debug)] #[derive(cynic::QueryVariables, Debug)]
pub struct TournamentSetsVarsRaw<'a> { pub struct TournamentSetsVarsRaw<'a> {
// HACK: This should really be an optional variable, but there seems to be a
// server-side bug that completely breaks everything when this isn't passed.
last_query: Timestamp,
country: Option<&'a str>, country: Option<&'a str>,
game_id: ID, game_id: ID,
last_query: Option<Timestamp>,
state: Option<&'a str>, state: Option<&'a str>,
} }
@ -76,9 +79,9 @@ struct Entrant {
// Unwrap // Unwrap
pub struct TournamentSetsVars<'a> { pub struct TournamentSetsVars<'a> {
pub country: Option<&'a str>, pub last_query: Timestamp,
pub game_id: VideogameId, pub game_id: VideogameId,
pub last_query: Option<Timestamp>, pub country: Option<&'a str>,
pub state: Option<&'a str>, pub state: Option<&'a str>,
} }
@ -99,16 +102,16 @@ impl<'a> QueryUnwrap<TournamentSetsVarsRaw<'a>> for TournamentSets {
fn wrap_vars( fn wrap_vars(
TournamentSetsVars { TournamentSetsVars {
country,
game_id: VideogameId(game_id),
last_query, last_query,
game_id: VideogameId(game_id),
country,
state, state,
}: TournamentSetsVars, }: TournamentSetsVars,
) -> TournamentSetsVarsRaw { ) -> TournamentSetsVarsRaw {
TournamentSetsVarsRaw { TournamentSetsVarsRaw {
country,
game_id: ID(game_id),
last_query, last_query,
game_id: ID(game_id),
country,
state, state,
} }
} }