Skip to content
Snippets Groups Projects

Resolve "Split game object and add events readAnswer and questionEnd"

2 files
+ 11
9
Compare changes
  • Side-by-side
  • Inline
Files
2
+ 6
5
@@ -26,7 +26,7 @@ class Game {
10,
);
}
console.log(questions);
//console.log(questions);
for (let i = 0; i < questions.length; i++) {
const answers = await answerController.getAnswerForQuestion(questions[i]._id);
this.gameData[i] = {
@@ -38,16 +38,17 @@ class Game {
this.usersAnswers.set(user, []);
}
console.log(this.gameData);
//console.log(this.gameData);
return this.gameData;
}
addNewAnswer(user, answer) {
this.usersAnswers.get(user).push(answer);
return this.verifyAnswer(this.usersAnswers.get(user).length - 1, answer);
addNewAnswer(user, answer, index) {
this.usersAnswers.get(user)[index] = answer;
return this.verifyAnswer(index, answer);
}
verifyAnswer(questionNumber, answer) {
console.log(this.gameData[questionNumber]);
return this.gameData[questionNumber].answers[answer].is_correct;
}
Loading