Skip to content

Commit

Permalink
potential fix for timing bug when two question are asked simultaneusly
Browse files Browse the repository at this point in the history
  • Loading branch information
aceakash committed Dec 15, 2015
1 parent 761121d commit 227d5c5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ quizRepo.getQuestionCount()
var scoreboard = players.map(function(p){ return p.name.split('').join('_') + ": " + p.points; }).join("\n")
channel.send(":trophy: *Current Scores* :trophy: \n" + scoreboard);
} else if (prune(text) === 'q') {
state = states.waitingForAnswer;
quizRepo.getQuestionById(_.random(questionCount), function (err, doc) {
currentQuizItem = doc;
channel.send(util.format('[%s] %s ( %s )', doc.id, doc.q, formatAsBlanks(doc.a)));
Expand All @@ -97,7 +98,6 @@ quizRepo.getQuestionCount()
state = states.idle;
channel.send('Time up! The answer was: ' + currentQuizItem.a);
}, questionTimeoutSec * 1000);
state = states.waitingForAnswer;
console.log("Sent question:", currentQuizItem);
});
}
Expand Down

0 comments on commit 227d5c5

Please sign in to comment.