var numberOfReadyUsers = 0;
var totalAmountOfUsers = 0;
var ioReference = undefined;

var numberOfTimeOut = 0;

function manageUserPoll(userSocket, io){
    ioReference = io;
    
	userSocket.on("answer", function(indexOfAnswer){
		io.of('/showRoom').emit("answer", indexOfAnswer);
		io.of('/admin').emit("answer", indexOfAnswer);
        console.log("I emitted an answer to admin");
	});

	userSocket.on("ready-to-start-quizz", function(){
		numberOfReadyUsers++;
		console.log("RECEIVED READY from a user socket");
		if(totalAmountOfUsers = numberOfReadyUsers){
			console.log("Tout le monde est prêt");
			io.of('/admin').emit("all-users-are-ready");
		}
	});
}

function resetTimeOut(){
    numberOfTimeOut = 0;
    totalAmountOfUsers = 0;
    Object.keys(ioReference.nsps['/user'].connected).forEach(function(socketID) {
        totalAmountOfUsers++;
    });
}

function reset(){
	numberOfReadyUsers = 0;
    totalAmountOfUsers = 0;
    Object.keys(ioReference.nsps['/user'].connected).forEach(function(socketID) {
        totalAmountOfUsers++;
    });
    console.log("Waiting answer from " + totalAmountOfUsers + " users");
}

exports.manageUserPoll = manageUserPoll;
exports.reset = reset;
@@ -83,34 +83,8 @@
 d;%0A%0A
-var numberOfTimeOut = 0;%0A%0A
 func
@@ -637,209 +637,8 @@
 %0A%7D%0A%0A
-function resetTimeOut()%7B%0A    numberOfTimeOut = 0;%0A    totalAmountOfUsers = 0;%0A    Object.keys(ioReference.nsps%5B'/user'%5D.connected).forEach(function(socketID) %7B%0A        totalAmountOfUsers++;%0A    %7D);%0A%7D%0A%0A
 func

remove unused