From ae76e48950a5437f198a382ea30e17d737cc38bc Mon Sep 17 00:00:00 2001 From: Nia Calia-Bogan Date: Fri, 19 Nov 2021 14:30:03 -0500 Subject: [PATCH] Fix meeting creation context bug --- graphql/rcos/meetings/creation/context.graphql | 7 +++++-- src/api/rcos/meetings/creation/context.rs | 9 ++------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/graphql/rcos/meetings/creation/context.graphql b/graphql/rcos/meetings/creation/context.graphql index fb85a726..6cf204d3 100644 --- a/graphql/rcos/meetings/creation/context.graphql +++ b/graphql/rcos/meetings/creation/context.graphql @@ -1,8 +1,11 @@ -query CreationContext($host: [uuid!]!, $semester_filter: semesters_bool_exp!) { +query CreationContext($host: [uuid!]!, $today: date!, $include_semesters: [String!]!) { # Semesters in which a meeting can be created. This will be # all current and future semesters in ascending order. available_semesters: semesters( - where: $semester_filter, + where: {_or: [ + {end_date: {_gte: $today}}, + {semester_id: {_in: $include_semesters}} + ]}, order_by: {start_date: asc} ) { semester_id diff --git a/src/api/rcos/meetings/creation/context.rs b/src/api/rcos/meetings/creation/context.rs index bf407e25..da422f60 100644 --- a/src/api/rcos/meetings/creation/context.rs +++ b/src/api/rcos/meetings/creation/context.rs @@ -25,13 +25,8 @@ impl CreationContext { ) -> Result { send_query::(creation_context::Variables { host: host.map(|h| vec![h]).unwrap_or(vec![]), - semester_filter: serde_json::from_value(json!({ - "_or": [ - { "end_date": { "_gte": Utc::today().naive_utc() }}, - { "semester_id": {"_in": include_semesters }} - ] - })) - .map_err(|_| TelescopeError::ise("Malformed semester filter in GraphQL query."))?, + today: Utc::today().naive_utc(), + include_semesters }) .await }