Browse Source

add exam questions reload and new Result component

master
Dslak 6 years ago
parent
commit
beeb6b7ff9
  1. 9
      vds-app/App/components/Variables.js
  2. 1
      vds-app/App/screens/QuizIndex.js
  3. 36
      vds-app/App/screens/Results.js
  4. 4
      vds-app/app.json

9
vds-app/App/components/Variables.js

@ -37,9 +37,10 @@ export const texts = {
materials: "Materiali",
meteorology: "Meteorologia e aerologia",
physiopathology: "Fisiopatologia del volo",
piloting_techniques: "Tecniche di pilotaggio"
piloting_techniques: "Tecniche di pilotaggio",
restart: "Ricomincia"
}
/*
export const examScheme = [
{section: "aerodynamics", questions: 8, points: 3},
{section: "firstAid", questions: 1, points: 2},
@ -51,14 +52,14 @@ export const examScheme = [
{section: "physiopathology", questions: 1, points: 2},
{section: "pilotingTechniques", questions: 5, points: 4}
]
*/
/*
export const examScheme = [
{section: "aerodynamics", questions: 1, points: 3},
{section: "firstAid", questions: 1, points: 2},
{section: "flightSafety", questions: 1, points: 4},
{section: "instruments", questions: 1, points: 2}
]
*/
export const credentials = {
adMobUnitIDTest: "ca-app-pub-3940256099942544/6300978111",
adMobUnitID: "ca-app-pub-4145771316565790/1848957462" //"ca-app-pub-3940256099942544/6300978111" // "ca-app-pub-4145771316565790/1848957462",

1
vds-app/App/screens/QuizIndex.js

@ -30,7 +30,6 @@ export default ({ navigation }) => (
<ScrollView style={[{ backgroundColor: colors.dark_blue }]}>
<StatusBar barStyle="dark-content" />
<RowItem name={texts.aerodynamics} color={colors.blue} textColor={colors.white} onPress={()=>
navigation.navigate("Quiz", {
title: texts.aerodynamics,

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

@ -32,15 +32,30 @@ const styles = StyleSheet.create({
},
box: {
position: "absolute",
top: (screen.height/2)-220,
width: screen.width-80,
top: screen.width/4,
left: 40,
width: screen.width-80,
borderRadius: 15,
backgroundColor: colors.white_alpha,
borderColor: colors.white,
borderWidth: 4,
paddingVertical: 30
},
boxCorrect: {
borderColor: colors.green,
},
boxWrong: {
borderColor: colors.red,
},
boxUnsafe: {
borderColor: colors.orange,
},
button: {
position: "absolute",
bottom: 40,
left: 40,
width: screen.width-80
},
text: {
color: colors.white,
fontSize: 22,
@ -101,9 +116,11 @@ class Results extends React.Component {
const currentResults = this.props.navigation.getParam("results")
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 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
boxStyle = percentage >= 80 ? percentage >= 85 ? styles.boxCorrect : styles.boxUnsafe : styles.boxWrong
}
console.log(currentResults)
@ -124,7 +141,7 @@ class Results extends React.Component {
</View>
<SafeAreaView style={styles.safearea}>
<View style={styles.box}>
<View style={[styles.box, boxStyle]}>
<Text style={styles.text}>
<Text style={styles.textLabel}>{`${texts.corrects}: ${currentResults.correct}`}</Text>
</Text>
@ -145,6 +162,19 @@ class Results extends React.Component {
}
</View>
<View style={styles.button}>
<Button
text={texts.restart}
onPress={() => {
this.props.navigation.navigate("Splash", {
title: texts.section_quizzes,
color: colors.blue
})}
}
/>
</View>
</SafeAreaView>
</View>

4
vds-app/app.json

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

Loading…
Cancel
Save