mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-29 21:41:00 +00:00
I am a stupid idiot again
This commit is contained in:
@@ -182,13 +182,13 @@ io.on('connection', function(socket){
|
|||||||
db.collection(coll).find({skip: false}, function(err, docs){
|
db.collection(coll).find({skip: false}, function(err, docs){
|
||||||
if(docs.length == 1)
|
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);
|
change_song(coll);
|
||||||
}else{
|
}else{
|
||||||
db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){
|
db.collection(coll).update({views:{$exists:true}}, {$push:{skips:guid}}, function(err, d){
|
||||||
//reply with skips or something
|
//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
|
}else
|
||||||
|
|||||||
Reference in New Issue
Block a user