Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AdminLessonExerciseCard types and getExercises query #2410

Merged

Conversation

flacial
Copy link
Member

@flacial flacial commented Oct 10, 2022

Related to #1990

Description

When using AdminLessonExerciseCard, we'll pass exercise[i] from getExercises query.

exercise type in AdminLessonExerciseCard is:

export type Exercise = {
  __typename?: 'Exercise'
  answer: Scalars['String']
  author: User
  description: Scalars['String']
  explanation?: Maybe<Scalars['String']>
  flagReason?: Maybe<Scalars['String']>
  flaggedAt?: Maybe<Scalars['String']>
  flaggedBy?: Maybe<User>
  flaggedById?: Maybe<Scalars['Int']>
  id: Scalars['Int']
  module: Module
  testStr?: Maybe<Scalars['String']>
}

And we're trying to pass the exercise as:

id
author {
  id
}
module {
  name
  lesson {
    slug
  }
}
description
answer
explanation

This will result in two errors. One would be the mismatch between the author type we're passing and Exercise.author from GraphQL types. Second would be mismatch between the module types.

Solution

Narrow the exercise and user types to only include what we need and update the getExercise query to include the author's username, email, and discordUsername in order to use them in the component.

@vercel
Copy link

vercel bot commented Oct 10, 2022

@flacial is attempting to deploy a commit to the c0d3-prod Team on Vercel.

A member of the Team first needs to authorize it.

@codecov
Copy link

codecov bot commented Oct 10, 2022

Codecov Report

Merging #2410 (78227c8) into master (f1d83d1) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master     #2410   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          185       185           
  Lines         3286      3286           
  Branches       872       872           
=========================================
  Hits          3286      3286           
Impacted Files Coverage Δ
__dummy__/getExercisesData.ts 100.00% <ø> (ø)
...mponents/admin/lessons/AdminLessonExerciseCard.tsx 100.00% <ø> (ø)

@vercel
Copy link

vercel bot commented Oct 11, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
c0d3-app ✅ Ready (Inspect) Visit Preview Oct 11, 2022 at 8:24PM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants