|
@ -70,8 +70,10 @@ class Exam extends React.Component { |
|
|
return nextState |
|
|
return nextState |
|
|
}, |
|
|
}, |
|
|
() => { |
|
|
() => { |
|
|
|
|
|
if(this.state.timer > 1 || (this.state.correctCount+this.state.wrongCount) < this.state.totalCount) { |
|
|
setTimeout(() => this.nextQuestion(), 750) |
|
|
setTimeout(() => this.nextQuestion(), 750) |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -79,7 +81,7 @@ class Exam extends React.Component { |
|
|
this.setState( (state) => { |
|
|
this.setState( (state) => { |
|
|
const updatedIndexes = state.availableIds.filter( item => item != state.activeQuestionId) |
|
|
const updatedIndexes = state.availableIds.filter( item => item != state.activeQuestionId) |
|
|
const nextId = updatedIndexes[Math.floor(Math.random() * updatedIndexes.length)] |
|
|
const nextId = updatedIndexes[Math.floor(Math.random() * updatedIndexes.length)] |
|
|
let resultsShow = this.state.timer <= 1 || false |
|
|
|
|
|
|
|
|
let resultsShow = (this.state.timer <= 1 || (this.state.correctCount+this.state.wrongCount) == this.state.totalCount) ? true : false |
|
|
|
|
|
|
|
|
if (!updatedIndexes.length) { |
|
|
if (!updatedIndexes.length) { |
|
|
resultsShow = true |
|
|
resultsShow = true |
|
@ -112,7 +114,7 @@ class Exam extends React.Component { |
|
|
}, 1000) |
|
|
}, 1000) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(this.state.timer < 1) { |
|
|
|
|
|
|
|
|
if(this.state.timer < 1 || (this.state.correctCount+this.state.wrongCount) == this.state.totalCount) { |
|
|
clearInterval(interval) |
|
|
clearInterval(interval) |
|
|
setTimeout( () => { |
|
|
setTimeout( () => { |
|
|
this.props.navigation.popToTop() |
|
|
this.props.navigation.popToTop() |
|
|