Fix voteskip calculation

This commit is contained in:
Calvin Montgomery 2013-08-01 00:03:56 -04:00
parent 7477c64ae2
commit 103e01042e
4 changed files with 6 additions and 6 deletions

View File

@ -1550,8 +1550,8 @@ Channel.prototype.tryVoteskip = function(user) {
} }
this.voteskip.vote(user.ip, 0); this.voteskip.vote(user.ip, 0);
this.broadcastVoteskipUpdate(); this.broadcastVoteskipUpdate();
var need = parseInt(this.users.length * this.opts.voteskip_ratio); var count = this.users.length - this.afkcount;
need -= this.afkcount; var need = parseInt(count * this.opts.voteskip_ratio);
if(this.voteskip.counts[0] >= need) { if(this.voteskip.counts[0] >= need) {
this.playNext(); this.playNext();
} }

View File

@ -2,7 +2,7 @@
"author": "Calvin Montgomery", "author": "Calvin Montgomery",
"name": "CyTube", "name": "CyTube",
"description": "Online media synchronizer and chat", "description": "Online media synchronizer and chat",
"version": "2.2.0", "version": "2.2.1",
"repository": { "repository": {
"url": "http://github.com/calzoneman/sync" "url": "http://github.com/calzoneman/sync"
}, },

View File

@ -6,7 +6,7 @@ var Logger = require("./logger");
var Channel = require("./channel"); var Channel = require("./channel");
var User = require("./user"); var User = require("./user");
const VERSION = "2.2.0"; const VERSION = "2.2.1";
function getIP(req) { function getIP(req) {
var raw = req.connection.remoteAddress; var raw = req.connection.remoteAddress;

View File

@ -96,8 +96,8 @@ User.prototype.setAFK = function (afk) {
} }
if(chan.voteskip) { if(chan.voteskip) {
chan.voteskip.unvote(this.ip); chan.voteskip.unvote(this.ip);
var need = parseInt(chan.users.length * chan.opts.voteskip_ratio); var count = chan.users.length - chan.afkcount;
need -= chan.afkcount; var need = parseInt(count * chan.opts.voteskip_ratio);
if(chan.voteskip.counts[0] >= need) { if(chan.voteskip.counts[0] >= need) {
chan.playNext(); chan.playNext();
} }