diff --git a/svg/results.svg b/svg/results.svg new file mode 100644 index 0000000..eeb47a1 --- /dev/null +++ b/svg/results.svg @@ -0,0 +1,822 @@ + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/vds-app/App/assets/bg.jpg b/vds-app/App/assets/bg.jpg new file mode 100644 index 0000000..084c29d Binary files /dev/null and b/vds-app/App/assets/bg.jpg differ diff --git a/vds-app/App/assets/check.png b/vds-app/App/assets/check.png index 3821204..3b24fa0 100644 Binary files a/vds-app/App/assets/check.png and b/vds-app/App/assets/check.png differ diff --git a/vds-app/App/assets/check@2x.png b/vds-app/App/assets/check@2x.png deleted file mode 100644 index 4a4cc7e..0000000 Binary files a/vds-app/App/assets/check@2x.png and /dev/null differ diff --git a/vds-app/App/assets/check@3x.png b/vds-app/App/assets/check@3x.png deleted file mode 100644 index 777df21..0000000 Binary files a/vds-app/App/assets/check@3x.png and /dev/null differ diff --git a/vds-app/App/assets/close.png b/vds-app/App/assets/close.png index 28f62c6..b98c2af 100644 Binary files a/vds-app/App/assets/close.png and b/vds-app/App/assets/close.png differ diff --git a/vds-app/App/assets/close@2x.png b/vds-app/App/assets/close@2x.png deleted file mode 100644 index 5289b00..0000000 Binary files a/vds-app/App/assets/close@2x.png and /dev/null differ diff --git a/vds-app/App/assets/close@3x.png b/vds-app/App/assets/close@3x.png deleted file mode 100644 index c6d6748..0000000 Binary files a/vds-app/App/assets/close@3x.png and /dev/null differ diff --git a/vds-app/App/assets/error.jpg b/vds-app/App/assets/error.jpg new file mode 100644 index 0000000..0888362 Binary files /dev/null and b/vds-app/App/assets/error.jpg differ diff --git a/vds-app/App/assets/panorama.jpg b/vds-app/App/assets/panorama.jpg new file mode 100644 index 0000000..fddc737 Binary files /dev/null and b/vds-app/App/assets/panorama.jpg differ diff --git a/vds-app/App/assets/panorama2.jpg b/vds-app/App/assets/panorama2.jpg new file mode 100644 index 0000000..6d579ef Binary files /dev/null and b/vds-app/App/assets/panorama2.jpg differ diff --git a/vds-app/App/assets/passed.jpg b/vds-app/App/assets/passed.jpg new file mode 100644 index 0000000..ef890a6 Binary files /dev/null and b/vds-app/App/assets/passed.jpg differ diff --git a/vds-app/App/assets/unsafe.jpg b/vds-app/App/assets/unsafe.jpg new file mode 100644 index 0000000..3fdf29b Binary files /dev/null and b/vds-app/App/assets/unsafe.jpg differ diff --git a/vds-app/App/components/Alert.js b/vds-app/App/components/Alert.js index 71d70bf..81a83d6 100644 --- a/vds-app/App/components/Alert.js +++ b/vds-app/App/components/Alert.js @@ -34,6 +34,7 @@ const styles = StyleSheet.create({ export const Alert = ({ correct, visible }) => { if (!visible) return null + const icon = correct ? require("../assets/check.png") : require("../assets/close.png") diff --git a/vds-app/App/components/Results.js b/vds-app/App/components/Results.js index 238c897..b3aac0e 100644 --- a/vds-app/App/components/Results.js +++ b/vds-app/App/components/Results.js @@ -1,57 +1,54 @@ import React from "react" -import { View, StyleSheet, Dimensions, Text } from "react-native" +import { View, StyleSheet, Dimensions, Text, Image, ImageBackground } from "react-native" import { colors, texts } from "../components/Variables" const screen = Dimensions.get("window") +const imgError = require("../assets/error.jpg") +const imgUnsafe = require("../assets/unsafe.jpg") +const imgPassed = require("../assets/passed.jpg") +const imgPanorama = require("../assets/panorama.jpg") +const imgPanorama2 = require("../assets/panorama2.jpg") const styles = StyleSheet.create({ container: { - position: "absolute", top: 0, - bottom: 0, left: 0, - right: 0, flex: 1, alignItems: "center", - justifyContent: "center" + justifyContent: "center", + height: screen.height-80, + width: screen.width, + backgroundColor: colors.white_alpha }, box: { - backgroundColor: colors.green_alpha, - width: screen.width / 1.1, - height: 320, - borderRadius: 15, - borderColor: colors.white_alpha, - borderWidth: 5, - alignItems: "center", - justifyContent: "center" - }, - boxWrong: { - backgroundColor: colors.red_alpha, - width: screen.width / 1.1, - height: 320, - borderRadius: 15, - borderColor: colors.white_alpha, - borderWidth: 5, - alignItems: "center", - justifyContent: "center" - }, - boxUnsafe: { - backgroundColor: colors.orange, - width: screen.width / 1.1, - height: 320, + position: "absolute", + top: (screen.height/2)-220, + width: screen.width-50, borderRadius: 15, + height: 420, borderColor: colors.white_alpha, - borderWidth: 5, - alignItems: "center", - justifyContent: "center" + borderWidth: 0 }, text: { color: colors.white, - fontSize: 25, + fontSize: 22, + textAlign: "center", + fontWeight: "400", + lineHeight: 40, + textShadowColor: 'rgba(0, 0, 0, 0.75)', + textShadowOffset: {width: -1, height: 1}, + textShadowRadius: 10 + }, + textSmall: { + marginTop: 20, + color: colors.white, + fontSize: 26, textAlign: "center", - letterSpacing: -0.02, fontWeight: "500", - lineHeight: 50 + lineHeight: 30, + textShadowColor: 'rgba(0, 0, 0, 0.75)', + textShadowOffset: {width: -1, height: 1}, + textShadowRadius: 10 }, textLabel: { paddingHorizontal: 20, @@ -65,29 +62,64 @@ const styles = StyleSheet.create({ }, unsafe: { color: colors.yellow + }, + bg: { + width: "100%", + height: "100%", + borderRadius: 5, + paddingVertical: 50 + }, + bgStyle: { + borderRadius: 0, + opacity: 0.8, + borderColor: colors.white_alpha, + borderWidth: 0 } }) -export const Results = ({ total, correct, wrong, visible }) => { +export const Results = ({ results, visible }) => { if (!visible) return null - const percentage = total ? (100/total) * correct : 0 - const boxStyle = percentage >= 80 ? percentage >= 85 ? styles.box : styles.boxUnsafe : styles.boxWrong - const percentStyle = percentage >= 80 ? percentage >= 85 ? styles.correct : styles.unsafe : styles.wrong + //const percentage = results.totalPoints ? (100/results.totalPoints) * results.points : 0 + const percentage = results.total ? (100/results.total) * results.correct : 0 + let bgImage = results.points >= 80 ? results.points >= 85 ? imgPassed : imgUnsafe : imgError + let imgPanoramaResult = results.points >= 80 ? imgPanorama : imgPanorama2 + + if(!results.isExam) { + bgImage = percentage >= 80 ? percentage >= 85 ? imgPassed : imgUnsafe : imgError + imgPanoramaResult = percentage >= 80 ? imgPanorama : imgPanorama2 + } return ( - - + + + + + + + - {`${texts.corrects}: ${correct}`} + {`${texts.corrects}: ${results.correct}`} - {`${texts.wrongs}: ${wrong}`} + {`${texts.wrongs}: ${results.wrong}`} {`${texts.percentage}: ${Math.round(percentage)}%`} + + {`${texts.points}: ${results.points}/${results.totalPoints}`} + + + {results.isExam ? + + {results.points >= 80 ? results.points >= 85 ? texts.exam_passed : texts.exam_needs_oral : texts.exam_not_passed} + : + } + + - + + ) } diff --git a/vds-app/App/components/Variables.js b/vds-app/App/components/Variables.js index 74e4d56..f673ca9 100644 --- a/vds-app/App/components/Variables.js +++ b/vds-app/App/components/Variables.js @@ -22,9 +22,13 @@ export const texts = { section_quizzes: "Quiz per argomento", exam: "Simulazione esame", exam_simulation: "30 domande in 30min", + exam_passed: "Esame superato!", + exam_not_passed: "Esame non superato!", + exam_needs_oral: "Necessaria prova orale!", corrects: "Corrette", wrongs: "Sbagliate", percentage: "Percentuale", + points: "Punti", aerodynamics: "Aerodinamica", first_aid: "Primo soccorso", flight_safety: "Sicurezza in volo", diff --git a/vds-app/App/data/firstAid.js b/vds-app/App/data/firstAid.js index 30e2b53..b44615d 100644 --- a/vds-app/App/data/firstAid.js +++ b/vds-app/App/data/firstAid.js @@ -147,6 +147,15 @@ const questions = [ { id: "1", text: "Lasciare uscire più sangue possibile onde lavare la ferita." + }, + { + id: "2", + text: "Interrompere il flusso sanguigno con laccio emostatico posto tra la lesione ed il cuore o con idoneo tampone posto sulla ferita.", + correct: true + }, + { + id: "3", + text: "Distendere l’infortunato con la ferita posta verso l’alto." } ] }, diff --git a/vds-app/App/data/test.js b/vds-app/App/data/test.js new file mode 100644 index 0000000..64cb62e --- /dev/null +++ b/vds-app/App/data/test.js @@ -0,0 +1,64 @@ +const questions = [ + { + id: "3001", + question: "Quale comportamento è auspicabile appena effettuato un soccorso d’emergenza?", + points: "2", + answers: [ + { + id: "1", + text: "Si trasporta il ferito all’ospedale con qualsiasi mezzo disponibile seguendolo da vicino." + }, + { + id: "2", + text: "VERA - Far trasportare all’ospedale con mezzo idoneo ed abilitato l’infortunato prendendosi cura dei suoi effetti personali ed avvisando al più presto i suoi parenti più prossimi.", + correct: true + }, + { + id: "3", + text: "Una volta chiamate si attende che giungano le autorità di polizia e si lascia a esse ogni incombenza." + } + ] + }, + { + id: "3002", + question: "Qual è, tra questi, il modo migliore per accompagnare un infortunato con una lesione leggera in grado di camminare?", + points: "2", + answers: [ + { + id: "1", + text: "Procurandogli un paio di stampelle." + }, + { + id: "2", + text: "Portandolo a spalle." + }, + { + id: "3", + text: "VERA - Mettendosi al suo fianco, dal lato della lesione e cingendogli la vita con il braccio, se possibile.", + correct: true + } + ] + }, + { + id: "3003", + question: "Come comportarsi alla presenza di un infortunato di cui si sospettano lesioni interne di entità sconosciuta?", + points: "2", + answers: [ + { + id: "1", + text: "Ispezionarlo attentamente, interrogandolo sulle parti dolenti e facendolo muovere se può, indi chiamare i mezzi di soccorso." + }, + { + id: "2", + text: "VERA - Interrompere il flusso sanguigno con laccio emostatico posto tra la lesione ed il cuore o con idoneo tampone posto sulla ferita.", + correct: true + }, + { + id: "3", + text: "Distendere l’infortunato con la ferita posta verso l’alto." + } + ] + } +] + +export default questions diff --git a/vds-app/App/screens/Exam.js b/vds-app/App/screens/Exam.js index c177921..110be7f 100644 --- a/vds-app/App/screens/Exam.js +++ b/vds-app/App/screens/Exam.js @@ -2,23 +2,21 @@ import React from "react" import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView } from "react-native" import { Button, ButtonContainer } from "../components/Button" -import { Alert } from "../components/Alert" +//import { Alert } from "../components/Alert" import { Results } from "../components/Results" import { colors } from "../components/Variables" const styles = StyleSheet.create({ container: { backgroundColor: colors.blue, - flex: 1, - paddingHorizontal: 20 + flex: 1 }, text: { color: colors.white, fontSize: 20, textAlign: "center", fontWeight: "600", - paddingVertical: 20, - marginTop: 20, + paddingVertical: 20 }, timer: { color: colors.white, @@ -31,6 +29,7 @@ const styles = StyleSheet.create({ safearea: { flex: 1, marginTop: 20, + paddingHorizontal: 20, justifyContent: "space-between" } }) @@ -42,6 +41,8 @@ class Exam extends React.Component { state = { correctCount: 0, + pointsCount: 0, + totalPoints: 0, wrongCount: 0, totalCount: this.props.navigation.getParam("questions", []).length, availableIds: this.props.navigation.getParam("questions", []).map(a => a.id), @@ -54,13 +55,14 @@ class Exam extends React.Component { timer: maxTime } - answer = (correct, id) => { + answer = (correct, id, points) => { this.setState( state => { - const nextState = { answered: true, clickedId: id } + const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(points)} if (correct) { nextState.correctCount = state.correctCount + 1 + nextState.pointsCount = state.pointsCount + parseInt(points) nextState.answerCorrect = true } else { nextState.wrongCount = state.wrongCount + 1 @@ -87,7 +89,7 @@ class Exam extends React.Component { resultsShow = true setTimeout( () => { this.props.navigation.popToTop() - }, 5000) + }, 10000) } return { @@ -99,6 +101,10 @@ class Exam extends React.Component { }) } + componentWillUnmount(){ + clearInterval(interval) + } + render() { const questions = this.props.navigation.getParam("questions", []) const question = questions.filter(item => item.id == this.state.activeQuestionId)[0] || questions[0] @@ -118,7 +124,7 @@ class Exam extends React.Component { clearInterval(interval) setTimeout( () => { this.props.navigation.popToTop() - }, 5000) + }, 10000) } return ( @@ -128,6 +134,8 @@ class Exam extends React.Component { ]} > + + {!this.state.results ? {new Date(this.state.timer * 1000).toISOString().substr(11, 8)} @@ -139,7 +147,7 @@ class Exam extends React.Component { key={answer.id} text={answer.text} colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}} - onPress={() => this.answer(answer.correct, answer.id)} + onPress={() => this.answer(answer.correct, answer.id, question.points)} /> ))} @@ -149,14 +157,17 @@ class Exam extends React.Component { {`${this.state.correctCount+this.state.wrongCount}/${this.state.totalCount}`} - + : } + diff --git a/vds-app/App/screens/Quiz.js b/vds-app/App/screens/Quiz.js index 92cf1cf..340a52b 100644 --- a/vds-app/App/screens/Quiz.js +++ b/vds-app/App/screens/Quiz.js @@ -2,27 +2,26 @@ import React from "react" import { View, ScrollView, StyleSheet, StatusBar, Text, SafeAreaView } from "react-native" import { Button, ButtonContainer } from "../components/Button" -import { Alert } from "../components/Alert" +//import { Alert } from "../components/Alert" import { Results } from "../components/Results" import { colors } from "../components/Variables" const styles = StyleSheet.create({ container: { backgroundColor: colors.blue, - flex: 1, - paddingHorizontal: 20 + flex: 1 }, text: { color: colors.white, fontSize: 20, textAlign: "center", fontWeight: "600", - paddingVertical: 20, - marginTop: 20, + paddingVertical: 20 }, safearea: { flex: 1, marginTop: 20, + paddingHorizontal: 20, justifyContent: "space-between" } }) @@ -32,6 +31,8 @@ class Quiz extends React.Component { state = { correctCount: 0, wrongCount: 0, + pointsCount: 0, + totalPoints: 0, totalCount: this.props.navigation.getParam("questions", []).length, availableIds: this.props.navigation.getParam("questions", []).map(a => a.id), activeQuestionId: this.props.navigation.getParam("questions", [])[ @@ -42,13 +43,14 @@ class Quiz extends React.Component { results: false } - answer = (correct, id) => { + answer = (correct, id, points) => { this.setState( state => { - const nextState = { answered: true, clickedId: id } + const nextState = { answered: true, clickedId: id, totalPoints: state.totalPoints + parseInt(points)} if (correct) { nextState.correctCount = state.correctCount + 1 + nextState.pointsCount = state.pointsCount + parseInt(points) nextState.answerCorrect = true } else { nextState.wrongCount = state.wrongCount + 1 @@ -97,6 +99,8 @@ class Quiz extends React.Component { ]} > + + {!this.state.results ? {question.question} @@ -107,7 +111,7 @@ class Quiz extends React.Component { key={answer.id} text={answer.text} colorize={{id: answer.id, clicked: this.state.clickedId, answered: this.state.answered, isCorrect: answer.correct}} - onPress={() => this.answer(answer.correct, answer.id)} + onPress={() => this.answer(answer.correct, answer.id, question.points)} /> ))} @@ -117,11 +121,17 @@ class Quiz extends React.Component { {`${this.state.correctCount+this.state.wrongCount}/${this.state.totalCount}`} + : } diff --git a/vds-app/App/screens/QuizIndex.js b/vds-app/App/screens/QuizIndex.js index d10fd8c..c8d44b1 100644 --- a/vds-app/App/screens/QuizIndex.js +++ b/vds-app/App/screens/QuizIndex.js @@ -10,6 +10,7 @@ import materialsQuestions from "../data/materials" import meteorologyQuestions from "../data/meteorology" import physiopathologyQuestions from "../data/physiopathology" import pilotingTechniquesQuestions from "../data/pilotingTechniques" +import testQuestions from "../data/test" import { Button, ButtonContainer } from "../components/Button" import { RowItem } from "../components/RowItem" @@ -19,6 +20,7 @@ import { examQuestions } from "../components/ExamQuestions" export default ({ navigation }) => ( + navigation.navigate("Quiz", { title: texts.aerodynamics, diff --git a/vds-app/app.json b/vds-app/app.json index d9858c7..2e34d0c 100644 --- a/vds-app/app.json +++ b/vds-app/app.json @@ -8,7 +8,7 @@ "ios", "android" ], - "version": "1.2.0", + "version": "1.3.0", "orientation": "portrait", "icon": "./assets/icon.png", "splash": { @@ -26,7 +26,7 @@ "icon": "./assets/icon.png", "package": "com.dslak.vdsquiz", "permissions": [], - "versionCode": 2, + "versionCode": 3, "config": { "googleMobileAdsAppId": "ca-app-pub-4145771316565790~1876877627" }