2 changed files with 45 additions and 28 deletions
@ -0,0 +1,43 @@ |
|||||
|
import testQuestions from "../data/test" |
||||
|
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" |
||||
|
|
||||
|
import { examScheme } from "../components/Variables" |
||||
|
|
||||
|
let tmpQuestions = [] |
||||
|
|
||||
|
const allQuestions = { |
||||
|
aerodynamics: aerodynamicsQuestions, |
||||
|
firstAid: firstAidQuestions, |
||||
|
flightSafety: flightSafetyQuestions, |
||||
|
instruments: instrumentsQuestions, |
||||
|
legislation: legislationQuestions, |
||||
|
materials: materialsQuestions, |
||||
|
meteorology: meteorologyQuestions, |
||||
|
physiopathology: physiopathologyQuestions, |
||||
|
pilotingTechniques: pilotingTechniquesQuestions |
||||
|
} |
||||
|
|
||||
|
const generateQuestions = () => { |
||||
|
|
||||
|
examScheme.forEach( (elem) => { |
||||
|
let currentSection = allQuestions[elem.section] |
||||
|
for(let i=0; i<elem.questions; i++) { |
||||
|
const currentIndex = Math.floor(Math.random() * elem.questions) |
||||
|
//currentSection[currentIndex].question = elem.section + currentSection[currentIndex].question
|
||||
|
tmpQuestions.push(currentSection[currentIndex]) |
||||
|
currentSection = currentSection.filter( (item, index) => index != currentIndex) |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
generateQuestions() |
||||
|
|
||||
|
export const examQuestions = tmpQuestions |
Loading…
Reference in new issue