|
|
@@ -7,18 +7,18 @@ import * as faker from 'faker'; |
|
|
|
styleUrls: ['./quiz.page.scss'], |
|
|
|
}) |
|
|
|
export class QuizPage implements OnInit { |
|
|
|
secondsPerQuestion: number = 30; |
|
|
|
selectedQuestion: number = 0; |
|
|
|
secondsPerQuestion: number; |
|
|
|
selectedQuestion: number = 1; |
|
|
|
|
|
|
|
questions: Array<{ |
|
|
|
type: 'MCQ' | 'CARD', |
|
|
|
question: string, |
|
|
|
question: string | Array<string>, |
|
|
|
choices?: Array<{ |
|
|
|
value: string, |
|
|
|
text: string, |
|
|
|
}>, |
|
|
|
correctAnswer?: string, |
|
|
|
secondsAllotted?: number |
|
|
|
secondsAllotted: number |
|
|
|
}>; |
|
|
|
|
|
|
|
constructor() { } |
|
|
@@ -50,16 +50,19 @@ export class QuizPage implements OnInit { |
|
|
|
secondsAllotted: 50 |
|
|
|
}, { |
|
|
|
type: 'CARD', |
|
|
|
question: faker.lorem.sentence(), |
|
|
|
question: [faker.lorem.sentence(), faker.lorem.sentence(), faker.lorem.sentence(), faker.lorem.sentence()], |
|
|
|
secondsAllotted: 50 |
|
|
|
}]; |
|
|
|
|
|
|
|
this.secondsPerQuestion = this.questions[this.selectedQuestion].secondsAllotted; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
nextQuestion() { |
|
|
|
if (this.selectedQuestion < this.questions.length - 1) { |
|
|
|
this.selectedQuestion += 1; |
|
|
|
this.secondsPerQuestion = this.questions[this.selectedQuestion].secondsAllotted; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|