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

Diego fix logic display questions #14

Merged
merged 5 commits into from
Aug 27, 2020

Conversation

DiegoOTdC
Copy link
Collaborator

@DiegoOTdC DiegoOTdC commented Aug 27, 2020

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)

Copy link
Collaborator

@DarianRushworth DarianRushworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks really great, The remove actions and reducer logic is super smart for what we needed, Well Done!

@DiegoOTdC DiegoOTdC merged commit fe0bce7 into development Aug 27, 2020
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