From 227d5c572156ac36c61a328da42db2d6448020df Mon Sep 17 00:00:00 2001 From: Akash Date: Tue, 15 Dec 2015 16:59:29 +0000 Subject: [PATCH] potential fix for timing bug when two question are asked simultaneusly --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9743ba2..e58cd05 100644 --- a/index.js +++ b/index.js @@ -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))); @@ -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); }); }