-
Notifications
You must be signed in to change notification settings - Fork 69
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
Get exercises from backend on DOJO exercises page #2335
Merged
bryanjenningz
merged 4 commits into
garageScript:master
from
bryanjenningz:get-dojo-exercises-from-backend
Sep 21, 2022
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
e018c43
Get DOJO exercises from backend
bryanjenningz ab882ad
Use getExercisesData mock data in DOJO exercises tests
bryanjenningz 048699a
Merge branch 'master' into get-dojo-exercises-from-backend
bryanjenningz 3be8b47
Merge branch 'master' into get-dojo-exercises-from-backend
bryanjenningz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
import { GetExercisesQuery } from '../graphql' | ||
|
||
const getExercisesData: GetExercisesQuery = { | ||
lessons: [ | ||
{ | ||
title: 'Foundations of JavaScript', | ||
docUrl: '/curriculum/js0/primitive_data_and_operators', | ||
slug: 'js0' | ||
}, | ||
{ | ||
title: 'Variables & Functions', | ||
docUrl: '/curriculum/js1/hypertext_markup_language', | ||
slug: 'js1' | ||
}, | ||
{ | ||
title: 'Arrays', | ||
docUrl: '/curriculum/js2/introduction_to_testing_inner_properties', | ||
slug: 'js2' | ||
}, | ||
{ | ||
title: 'Objects', | ||
docUrl: '/curriculum/js3/preflight', | ||
slug: 'js3' | ||
}, | ||
{ | ||
title: 'Front End Engineering', | ||
docUrl: '/curriculum/js4/interactive_elements', | ||
slug: 'js4' | ||
}, | ||
{ | ||
title: 'End To End', | ||
docUrl: '/curriculum/js5/request_and_response', | ||
slug: 'js5' | ||
}, | ||
{ | ||
title: 'React, GraphQL, SocketIO', | ||
docUrl: '', | ||
slug: 'js6' | ||
}, | ||
{ | ||
title: 'JavaScript Algorithms', | ||
docUrl: | ||
'https://docs.google.com/document/d/1ekuu6VbN7qqypm71cVHT-BkdxYSwY0BBHLK8xGXSN1U/edit', | ||
slug: 'js7' | ||
}, | ||
{ | ||
title: 'Trees', | ||
docUrl: '', | ||
slug: 'js8' | ||
}, | ||
{ | ||
title: 'General Algorithms', | ||
docUrl: '', | ||
slug: 'js9' | ||
} | ||
], | ||
alerts: [], | ||
exercises: [ | ||
{ | ||
module: { | ||
name: 'Numbers', | ||
lesson: { | ||
slug: 'js0' | ||
} | ||
}, | ||
description: '```\nlet a = 5\na = a + 10\n// what is a?\n```', | ||
answer: '15', | ||
explanation: 'You can reassign variables that were created with "let".' | ||
}, | ||
{ | ||
module: { | ||
name: 'Numbers', | ||
lesson: { | ||
slug: 'js0' | ||
} | ||
}, | ||
description: '```\nlet a = 1\na += 2\n// what is a?\n```', | ||
answer: '3', | ||
explanation: '`a += 2` is a shorter way to write `a = a + 2`' | ||
}, | ||
{ | ||
module: { | ||
name: 'Numbers', | ||
lesson: { | ||
slug: 'js0' | ||
} | ||
}, | ||
description: '```\nlet a = 1\na -= 2\n// what is a?\n```', | ||
answer: '-1', | ||
explanation: '`a -= 2` is a shorter way to write `a = a - 2`' | ||
} | ||
] | ||
} | ||
|
||
export default getExercisesData |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { gql } from '@apollo/client' | ||
|
||
const GET_EXERCISES = gql` | ||
query GetExercises { | ||
lessons { | ||
title | ||
docUrl | ||
slug | ||
} | ||
alerts { | ||
id | ||
text | ||
type | ||
url | ||
urlCaption | ||
} | ||
exercises { | ||
module { | ||
name | ||
lesson { | ||
slug | ||
} | ||
} | ||
description | ||
answer | ||
explanation | ||
} | ||
} | ||
` | ||
|
||
export default GET_EXERCISES |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't sure what to call this query. It does more than just get the exercises - it gets the lessons and alerts too which are used on the DOJO exercises page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GET_DOJO_EXERCISES
maybe, but it's longer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, or maybe even something like
GET_DOJO_EXERCISES_PAGE_DATA
since we're getting all the data we need for the DOJO exercises page. MaybeGET_DOJO_EXERCISES
is fine. Maybe we should also changeGET_FLAGGED_EXERCISES
to beGET_FLAGGED_DOJO_EXERCISES
so that the naming convention is consistent.