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.
The Problem
When the user finishes an exercise it would go to the second exercise in level 1 but then go back to the first question. It wouldn't continue to the question in level 2.
Steps to fix this
Check if any exercise of the "allCurrentExercises" are already finished -> would be inside "completedExercises"
push the exercises that match into a new array; "commonElements"
create a leftOverExercises array where all of the commonElements are filtered out of the allCurrentExercises, so that you have an array with exercises that still need to be finished by the user.
use if statement to check if there are still exercises to be finished -> otherwise show "you are finished"
Create removeQuizQuestions in the store/exercise actions/reducer
Create removeCompletedExercises in the store/user actions/reducer
Add removeQuizQuestions and removeCompletedExercises in a dispatch to the homepage, so that every time the store will be empty when you go back to the homepage. ->Otherwise when you go finish an exercise and go to home, then go to the next exercise, instead of 3 you will see 6 questions.
remove all unnecessary code (like dispatch(getExerciseById()) on the QuizCode page)