|
|
@ -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) => { |
|
|
|