Skip to content

Commit

Permalink
Corrected the function - sortAShufleFromCasesArray - for when only ha…
Browse files Browse the repository at this point in the history
…ve 0/1 cases selected
  • Loading branch information
Darguima committed Feb 20, 2021
1 parent eb361a6 commit 8249409
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/TrainPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const TrainPage:React.FC<TrainPageProps> = ({ route: { params: { methodPhase } }
}, [])

const sortAShufleFromCasesArray = async () => {
if (casesArray.unsolved.length === 1) {
if (casesArray.unsolved.length === 1 && casesArray.solved.length !== 0) {
const newUnsolvedCasesArray: Array<fridrichCaseSchema> = casesArray.unsolved
const newSolvedCasesArray: Array<fridrichCaseSchema> = casesArray.solved

Expand All @@ -85,7 +85,7 @@ const TrainPage:React.FC<TrainPageProps> = ({ route: { params: { methodPhase } }
setCasesArray({ unsolved: newUnsolvedCasesArray, solved: newSolvedCasesArray })
}

setCaseOnScreen(casesArray.unsolved[0])
setCaseOnScreen(casesArray.unsolved[0] || { name: 'Final', shuffle: 'Final', solve: 'Final', solved: true })
}
}

Expand Down

0 comments on commit 8249409

Please sign in to comment.