From 4c88170bf2400a802221eb994d28dea137849a45 Mon Sep 17 00:00:00 2001 From: Dslak Date: Sun, 10 Nov 2019 17:38:35 +0100 Subject: [PATCH] fix exam timeout --- vds-app/App/screens/Exam.js | 32 ++++++++++++++++++-------------- vds-app/App/screens/Results.js | 4 ++-- vds-app/app.json | 4 ++-- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/vds-app/App/screens/Exam.js b/vds-app/App/screens/Exam.js index cd580bc..96cf918 100644 --- a/vds-app/App/screens/Exam.js +++ b/vds-app/App/screens/Exam.js @@ -109,6 +109,20 @@ class Exam extends React.Component { 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) => { this.setState( state => { @@ -151,17 +165,7 @@ class Exam extends React.Component { if (!updatedIndexes.length) { 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 { 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) { clearInterval(interval) - //setTimeout( () => { - //this.props.navigation.popToTop() - //}, 10000) + setTimeout ( () => { + this.showResults() + }, 1000) } return ( diff --git a/vds-app/App/screens/Results.js b/vds-app/App/screens/Results.js index f5c6302..0599701 100644 --- a/vds-app/App/screens/Results.js +++ b/vds-app/App/screens/Results.js @@ -155,11 +155,11 @@ class Results extends React.Component { const currentResults = this.props.navigation.getParam("results") const wrongAnswers = currentResults.wrongAnswers || null 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 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 } diff --git a/vds-app/app.json b/vds-app/app.json index d476eda..8cfea1b 100644 --- a/vds-app/app.json +++ b/vds-app/app.json @@ -8,7 +8,7 @@ "ios", "android" ], - "version": "1.6.2", + "version": "1.6.3", "orientation": "portrait", "icon": "./assets/icon.png", "splash": { @@ -26,7 +26,7 @@ "icon": "./assets/icon.png", "package": "com.dslak.vdsquiz", "permissions": [], - "versionCode": 9, + "versionCode": 10, "config": { "googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627" }