I am a stupid idiot again

This commit is contained in:
Kasper Rynning-Tønnesen
2015-04-16 11:33:02 +02:00
parent 6ef1c1631c
commit 2baac2d1d5

View File

@@ -182,13 +182,13 @@ io.on('connection', function(socket){
db.collection(coll).find({skip: false}, function(err, docs){
if(docs.length == 1)
{
if(lists[coll].length/2 <= docs[0]["skips"]+1)
if(lists[coll].length/2 <= docs[0]["skips"].length+1)
{
change_song(coll);
}else{
db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){
//reply with skips or something
socket.emit("toast", (docs[0]["skips"]+1) + " of "+ Math.floor(lists[coll].length/2) + " are needed to skip!");
socket.emit("toast", (Math.ceil(lists[coll].length/2) - docs[0]["skips"].length+1) + " more are needed to skip!");
});
}
}else