Browse Source

fix exam timeout

feature/upgrade_sdk
Dslak 6 years ago
parent
commit
4c88170bf2
  1. 32
      vds-app/App/screens/Exam.js
  2. 4
      vds-app/App/screens/Results.js
  3. 4
      vds-app/app.json

32
vds-app/App/screens/Exam.js

@ -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 (

4
vds-app/App/screens/Results.js

@ -155,11 +155,11 @@ class Results extends React.Component {
const currentResults = this.props.navigation.getParam("results") const currentResults = this.props.navigation.getParam("results")
const wrongAnswers = currentResults.wrongAnswers || null const wrongAnswers = currentResults.wrongAnswers || null
const percentage = currentResults.total ? (100/currentResults.total) * currentResults.correct : 0 const percentage = currentResults.total ? (100/currentResults.total) * currentResults.correct : 0
let resultStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.correct : styles.unsafe : styles.wrong
let resultStyle = ''//currentResults.points >= 80 ? currentResults.points >= 85 ? styles.correct : styles.unsafe : styles.wrong
let boxStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong let boxStyle = currentResults.points >= 80 ? currentResults.points >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
if(!currentResults.isExam) { if(!currentResults.isExam) {
resultStyle = percentage >= 80 ? percentage >= 85 ? styles.correct : styles.unsafe : styles.wrong
resultStyle = ''//percentage >= 80 ? percentage >= 85 ? styles.correct : styles.unsafe : styles.wrong
boxStyle = percentage >= 80 ? percentage >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong boxStyle = percentage >= 80 ? percentage >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
} }

4
vds-app/app.json

@ -8,7 +8,7 @@
"ios", "ios",
"android" "android"
], ],
"version": "1.6.2",
"version": "1.6.3",
"orientation": "portrait", "orientation": "portrait",
"icon": "./assets/icon.png", "icon": "./assets/icon.png",
"splash": { "splash": {
@ -26,7 +26,7 @@
"icon": "./assets/icon.png", "icon": "./assets/icon.png",
"package": "com.dslak.vdsquiz", "package": "com.dslak.vdsquiz",
"permissions": [], "permissions": [],
"versionCode": 9,
"versionCode": 10,
"config": { "config": {
"googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627" "googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627"
} }

Loading…
Cancel
Save