-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLimitedQuestionSelector.js
More file actions
55 lines (47 loc) · 1.5 KB
/
Copy pathLimitedQuestionSelector.js
File metadata and controls
55 lines (47 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
class LimitedQuestionSelector {
constructor() {
this.currentQuestionNumber = -1
this.numberOfQuestions = Math.min(80, questions.length)
this.questions = shuffle(questions)
.slice(0, this.numberOfQuestions)
.map(question => new QuestionAnswer(
question.question,
question.correctAnswer,
question.option1,
question.option2,
question.option3,
question.option4
))
this.configureHtml()
}
hasAutoNewQuestion() {
return true
}
hasCheckAnswer() {
return false
}
hasQuestionSelection() {
return true
}
isDone() {
return this.numberOfQuestions <= this.currentQuestionNumber + 1
}
newQuestion() {
if (this.isDone()) {
return
}
this.currentQuestionNumber += 1
return this.questions[this.currentQuestionNumber]
}
questionByNumber(questionNumber) {
this.currentQuestionNumber = questionNumber
return this.questions[this.currentQuestionNumber]
}
configureHtml() {
htmlConfigurer.hideEverything()
htmlConfigurer.showStatistics()
htmlConfigurer.showQuestionNavigation()
htmlConfigurer.showQuestionAnswer()
htmlConfigurer.showFinishTest()
}
}