|
@ -109,6 +109,20 @@ class Exam extends React.Component { |
|
|
return true |
|
|
return true |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
showResults = () => { |
|
|
|
|
|
this.props.navigation.navigate("Results", { |
|
|
|
|
|
results: { |
|
|
|
|
|
isExam: true, |
|
|
|
|
|
total: this.state.totalCount, |
|
|
|
|
|
correct: this.state.correctCount, |
|
|
|
|
|
wrong: this.state.wrongCount, |
|
|
|
|
|
points: this.state.pointsCount, |
|
|
|
|
|
totalPoints: this.state.totalPoints, |
|
|
|
|
|
wrongAnswers: this.state.wrongAnswers |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
answer = (correct, id, question) => { |
|
|
answer = (correct, id, question) => { |
|
|
this.setState( |
|
|
this.setState( |
|
|
state => { |
|
|
state => { |
|
@ -151,17 +165,7 @@ class Exam extends React.Component { |
|
|
if (!updatedIndexes.length) { |
|
|
if (!updatedIndexes.length) { |
|
|
|
|
|
|
|
|
clearInterval(interval) |
|
|
clearInterval(interval) |
|
|
this.props.navigation.navigate("Results", { |
|
|
|
|
|
results: { |
|
|
|
|
|
isExam: true, |
|
|
|
|
|
total: this.state.totalCount, |
|
|
|
|
|
correct: this.state.correctCount, |
|
|
|
|
|
wrong: this.state.wrongCount, |
|
|
|
|
|
points: this.state.pointsCount, |
|
|
|
|
|
totalPoints: this.state.totalPoints, |
|
|
|
|
|
wrongAnswers: this.state.wrongAnswers |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
this.showResults() |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
this.setState( (state) => { |
|
|
this.setState( (state) => { |
|
@ -196,9 +200,9 @@ class Exam extends React.Component { |
|
|
|
|
|
|
|
|
if(this.state.timer < 1 || (this.state.correctCount+this.state.wrongCount) == this.state.totalCount) { |
|
|
if(this.state.timer < 1 || (this.state.correctCount+this.state.wrongCount) == this.state.totalCount) { |
|
|
clearInterval(interval) |
|
|
clearInterval(interval) |
|
|
//setTimeout( () => {
|
|
|
|
|
|
//this.props.navigation.popToTop()
|
|
|
|
|
|
//}, 10000)
|
|
|
|
|
|
|
|
|
setTimeout ( () => { |
|
|
|
|
|
this.showResults() |
|
|
|
|
|
}, 1000) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|