-
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
Replace deleteExercise with removeExercise resolver in the client #2668
Replace deleteExercise with removeExercise resolver in the client #2668
Conversation
…ed-exercises-in-accordance-with-design-doc-1
…rciseCard This commit update the pages to use removeExercise and add conditions to not display removed exercise. In the future, we should let the backend handle this so the app don't consume a lot of the user bandwidth.
This commit update the pages to use removeExercise and add conditions to not display removed exercise. In the future, we should let the backend handle this so the app don't consume a lot of the user bandwidth.
This commit update the pages to use removeExercise and add conditions to not display removed exercise. In the future, we should let the backend handle this so the app don't consume a lot of the user bandwidth.
This commit update the pages to use removeExercise and add conditions to not display removed exercise. In the future, we should let the backend handle this so the app don't consume a lot of the user bandwidth.
This reverts commit 33c4ef4.
This reverts commit c54496f.
@flacial is attempting to deploy a commit to the c0d3-prod Team on Vercel. A member of the Team first needs to authorize it. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
I accidentally checked-out from a non-master branch, this is why there are some reverted commits. |
@@ -4,7 +4,7 @@ import React, { useState } from 'react' | |||
import { Collapse, Spinner } from 'react-bootstrap' |
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.
For this component, I noticed there's no error handling if the exercise wasn't removed/unflagged successfully.
@@ -193,7 +193,9 @@ const ExercisesPage = ({ lessonSlug }: ExercisesProps) => { | |||
const mapExercisesToExerciseCard = data?.exercises | |||
.filter( | |||
exercise => | |||
exercise.flaggedAt && exercise.module.lesson.slug === lessonSlug | |||
exercise.flaggedAt && | |||
!exercise.removedAt && |
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 added a condition to prevent the display of any removed exercises. Sending removed exercises to the client would be a waste of bandwidth, as they will not be displayed. Instead, it would be more efficient to have the backend filter out removed exercises and only send the ones that should be displayed to the client.
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.
Not only is it more efficient, it is the correct way. If the user is not supposed to see some data/be able to access it/perform some action, merely hiding it on the frontend is never enough, it should not be available at the client in the first place and backend should ensure that.
Codecov Report
@@ Coverage Diff @@
## master #2668 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 189 189
Lines 3510 3507 -3
Branches 970 973 +3
=========================================
- Hits 3510 3507 -3
|
…e-with-design-doc-1
…e-with-design-doc-1
Motivation
After adding the removeExercise resolver that aims at correcting our initial implementation for removing exercises, we need to use it in the client-side now.
Steps taken
deleteExercise
withremoveExercise
in mentor pagedeleteExercise
withremoveExercise
in admin/lessons pagedeleteExercise
withremoveExercise
inAdminLessonExerciseCard
componentdeleteExercise
withremoveExercise
in exercises pageTesting
/exercises/js0
SOLVE EXERCISES
/admin/lessons/js0/exercises
Remove
button/exercises/js0
again/curriculum/js0/mentor
Delete
button to remove the exercise/exercises/js0
and notice how the exercise isn't showingRelated issues