mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-12-08 20:48:48 +00:00
Fixed when it is changing song twice
This commit is contained in:
@@ -324,7 +324,7 @@ function vote(coll, id, guid, socket)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function change_song(coll)
|
function change_song(coll, id)
|
||||||
{
|
{
|
||||||
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
db.collection(coll).find({views:{$exists:true}}, function(err, docs){
|
||||||
if(docs[0]["removeplay"] == true)
|
if(docs[0]["removeplay"] == true)
|
||||||
@@ -335,6 +335,7 @@ function change_song(coll)
|
|||||||
})
|
})
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
|
if(id === undefined){
|
||||||
db.collection(coll).update({now_playing:true},
|
db.collection(coll).update({now_playing:true},
|
||||||
{$set:{
|
{$set:{
|
||||||
now_playing:false,
|
now_playing:false,
|
||||||
@@ -344,6 +345,17 @@ function change_song(coll)
|
|||||||
{
|
{
|
||||||
change_song_post(coll);
|
change_song_post(coll);
|
||||||
});
|
});
|
||||||
|
}else{
|
||||||
|
db.collection(coll).update({now_playing:true, id:id},
|
||||||
|
{$set:{
|
||||||
|
now_playing:false,
|
||||||
|
votes:0,
|
||||||
|
guids:[]
|
||||||
|
}}, function(err, docs)
|
||||||
|
{
|
||||||
|
change_song_post(coll);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user