diff --git a/src/components/Challenge/ChallengeCardOnGoing/ChallengeCardOnGoing.tsx b/src/components/Challenge/ChallengeCardOnGoing/ChallengeCardOnGoing.tsx index aea83c8f9988c6f7207b6c50fb7ef7089efea679..db6690f7c971b30849c5f54748e31e6c6bb518dd 100644 --- a/src/components/Challenge/ChallengeCardOnGoing/ChallengeCardOnGoing.tsx +++ b/src/components/Challenge/ChallengeCardOnGoing/ChallengeCardOnGoing.tsx @@ -86,17 +86,15 @@ const ChallengeCardOnGoing = ({ ) dispatch(updateUserChallengeList(updatedChallenge)) } - if (userChallenge.progress.quizProgress !== 5) navigate('/challenges/quiz') + if (!quizFinished) navigate('/challenges/quiz') } const goExploration = () => { - if (userChallenge.progress.explorationProgress !== 5) - navigate('/challenges/exploration') + if (!explorationFinished) navigate('/challenges/exploration') } const goAction = () => { - if (userChallenge.progress.actionProgress !== 5) - navigate('/challenges/action') + if (!actionFinished) navigate('/challenges/action') } useEffect(() => { @@ -124,9 +122,9 @@ const ChallengeCardOnGoing = ({ const unlockDuel = async () => { if ( userChallenge.duel.state === UserDuelState.LOCKED && - userChallenge.progress.actionProgress === 5 && - userChallenge.progress.quizProgress === 5 && - userChallenge.progress.explorationProgress === 5 + quizFinished && + explorationFinished && + actionFinished ) { const updatedChallenge = await challengeService.updateUserChallenge( { @@ -147,7 +145,15 @@ const ChallengeCardOnGoing = ({ return () => { subscribed = false } - }, [currentDataload, userChallenge, dispatch, challengeService]) + }, [ + currentDataload, + userChallenge, + dispatch, + challengeService, + quizFinished, + explorationFinished, + actionFinished, + ]) const quizButton = () => ( <Button