Browse Source

Merge branch 'bugfix/remove_delta_in_exam' into develop

feature/upgrade_sdk
Dslak 5 years ago
parent
commit
8f70efb104
  1. 37
      vds-app/App/screens/Recap.js
  2. 34
      vds-app/App/screens/Results.js
  3. 46
      vds-app/App/screens/Setup.js
  4. 19
      vds-app/App/screens/Splash.js
  5. 4
      vds-app/app.json

37
vds-app/App/screens/Recap.js

@ -127,21 +127,28 @@ class Recap extends React.Component {
handleBackButton = () => {
const tmpQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions,
storeWrongAnswers: this.state.storeWrongAnswers
})
return true
let tmpQuestions = []
AsyncStorage.getItem('setupData').then((value) => {
let setupData = JSON.parse(value)
examScheme.forEach( (elem) => {
let currentSection = setupData.excludeDelta ? allQuestions[elem.section].filter(item => !item.delta) : allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions,
storeWrongAnswers: this.state.storeWrongAnswers
})
return true
}).done()
}
render() {

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

@ -148,21 +148,27 @@ class Results extends React.Component {
handleBackButton = () => {
const tmpQuestions = []
examScheme.forEach( (elem) => {
let currentSection = allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
let tmpQuestions = []
AsyncStorage.getItem('setupData').then((value) => {
let setupData = JSON.parse(value)
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions,
storeWrongAnswers: this.state.storeWrongAnswers
})
return true
examScheme.forEach( (elem) => {
let currentSection = setupData.excludeDelta ? allQuestions[elem.section].filter(item => !item.delta) : allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions,
storeWrongAnswers: this.state.storeWrongAnswers
})
return true
}).done()
}

46
vds-app/App/screens/Setup.js

@ -4,6 +4,28 @@ import { View, ScrollView, StyleSheet, StatusBar, Text, CheckBox, SafeAreaView,
import { Button, ButtonContainer } from "../components/Button"
import { colors, texts, examScheme, resultsScheme} from "../components/Variables"
import aerodynamicsQuestions from "../data/aerodynamics"
import firstAidQuestions from "../data/firstAid"
import flightSafetyQuestions from "../data/flightSafety"
import instrumentsQuestions from "../data/instruments"
import legislationQuestions from "../data/legislation"
import materialsQuestions from "../data/materials"
import meteorologyQuestions from "../data/meteorology"
import physiopathologyQuestions from "../data/physiopathology"
import pilotingTechniquesQuestions from "../data/pilotingTechniques"
const allQuestions = {
aerodynamics: aerodynamicsQuestions,
firstAid: firstAidQuestions,
flightSafety: flightSafetyQuestions,
instruments: instrumentsQuestions,
legislation: legislationQuestions,
materials: materialsQuestions,
meteorology: meteorologyQuestions,
physiopathology: physiopathologyQuestions,
pilotingTechniques: pilotingTechniquesQuestions
}
const bgImage = require("../assets/bg.jpg")
const screen = Dimensions.get("window")
@ -158,8 +180,28 @@ class Setup extends React.Component {
}
handleBackButton = () => {
this.props.navigation.navigate("Splash")
return true
let tmpQuestions = []
AsyncStorage.getItem('setupData').then((value) => {
let setupData = JSON.parse(value)
examScheme.forEach( (elem) => {
let currentSection = setupData.excludeDelta ? allQuestions[elem.section].filter(item => !item.delta) : allQuestions[elem.section]
for(let i=0; i<elem.questions; i++) {
const currentIndex = Math.floor(Math.random() * currentSection.length)
tmpQuestions.push(currentSection[currentIndex])
currentSection = currentSection.filter( (item, index) => index != currentIndex)
}
})
this.props.navigation.navigate("Splash", {
examQuestions: tmpQuestions
})
return true
}).done()
}
changeSetup = (item) => {

19
vds-app/App/screens/Splash.js

@ -83,7 +83,8 @@ class Splash extends React.Component {
state = {
bannerExpanded: true,
timer: maxTime,
storeWrongAnswers: this.props.navigation.getParam("storeWrongAnswers", []) || []
storeWrongAnswers: this.props.navigation.getParam("storeWrongAnswers", []) || [],
setupData: {}
}
bannerError = (e) => {
@ -97,12 +98,20 @@ class Splash extends React.Component {
AsyncStorage.setItem('storeWrongAnswers', JSON.stringify([]))
}
this.setState( (state) => {
return {
storeWrongAnswers: value ? JSON.parse(value) : []
AsyncStorage.getItem('setupData').then((setup) => {
if(!setup) {
AsyncStorage.setItem('setupData', JSON.stringify({}))
}
})
this.setState( (state) => {
return {
storeWrongAnswers: value ? JSON.parse(value) : [],
setupData: setup ? JSON.parse(setup) : {}
}
})
}).done()
}).done()
}
componentWillUnmount() {

4
vds-app/app.json

@ -7,7 +7,7 @@
"ios",
"android"
],
"version": "3.6.1",
"version": "3.6.3",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
@ -25,7 +25,7 @@
"icon": "./assets/icon.png",
"package": "com.dslak.vdsquiz",
"permissions": [],
"versionCode": 19,
"versionCode": 20,
"config": {
"googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627"
}

Loading…
Cancel
Save