Ceil voteskip requirement instead of truncating

This commit is contained in:
calzoneman 2013-08-01 16:11:11 -04:00
parent 229f8a206a
commit 4937dca98e
3 changed files with 4 additions and 4 deletions

View File

@ -965,7 +965,7 @@ Channel.prototype.broadcastChatFilters = function() {
Channel.prototype.broadcastVoteskipUpdate = function() { Channel.prototype.broadcastVoteskipUpdate = function() {
var amt = this.voteskip ? this.voteskip.counts[0] : 0; var amt = this.voteskip ? this.voteskip.counts[0] : 0;
var count = this.users.length - this.afkers.length; var count = this.users.length - this.afkers.length;
var need = this.voteskip ? parseInt(count * this.opts.voteskip_ratio) : 0; var need = this.voteskip ? Math.ceil(count * this.opts.voteskip_ratio) : 0;
for(var i = 0; i < this.users.length; i++) { for(var i = 0; i < this.users.length; i++) {
if(Rank.hasPermission(this.users[i], "seeVoteskip") || if(Rank.hasPermission(this.users[i], "seeVoteskip") ||
this.leader == this.users[i]) { this.leader == this.users[i]) {
@ -1563,7 +1563,7 @@ Channel.prototype.checkVoteskipPass = function () {
return false; return false;
var count = this.users.length - this.afkers.length; var count = this.users.length - this.afkers.length;
var need = parseInt(count * this.opts.voteskip_ratio); var need = Math.ceil(count * this.opts.voteskip_ratio);
if(this.server.cfg["debug"]) { if(this.server.cfg["debug"]) {
console.log("afkers=", this.afkers.length); console.log("afkers=", this.afkers.length);
console.log("users =", this.users.length); console.log("users =", this.users.length);

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.2", "version": "2.2.3",
"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.2"; const VERSION = "2.2.3";
function getIP(req) { function getIP(req) {
var raw = req.connection.remoteAddress; var raw = req.connection.remoteAddress;