Fixed issue with viewercounter being below 0

This commit is contained in:
Kasper Rynning-Tønnesen
2017-11-21 11:27:01 +01:00
parent b92ff8146a
commit 789a3cc1e7
3 changed files with 6 additions and 6 deletions

View File

@@ -258,7 +258,7 @@ function del(params, socket, socketid) {
db.collection(coll).remove({id:params.id}, function(err, docs){
socket.emit("toast", "deletesong");
io.to(coll).emit("channel", {type:"deleted", value: params.id});
if(dont_increment) db.collection("frontpage_lists").update({_id: coll}, {$inc: {count: -1}, $set:{accessed: Functions.get_time()}}, {upsert: true}, function(err, docs){});
if(dont_increment) db.collection("frontpage_lists").update({_id: coll, count: {$gt: 0}}, {$inc: {count: -1}, $set:{accessed: Functions.get_time()}}, {upsert: true}, function(err, docs){});
});
}
});