Require at least one vote to skip

This commit is contained in:
Calvin Montgomery 2022-05-09 20:25:34 -07:00
parent cc283c0be9
commit fd451fe9d2
3 changed files with 22 additions and 2 deletions

View file

@ -80,7 +80,10 @@ VoteskipModule.prototype.update = function () {
const { counts } = this.poll.toUpdateFrame(false);
const { total, eligible, noPermission, afk } = this.calcUsercounts();
const need = Math.ceil(eligible * this.channel.modules.options.get("voteskip_ratio"));
const need = Math.max(
1, // Require at least one vote, see #944
Math.ceil(eligible * this.channel.modules.options.get("voteskip_ratio"))
);
if (counts[0] >= need) {
const info = `${counts[0]}/${eligible} skipped; ` +
`eligible voters: ${eligible} = total (${total}) - AFK (${afk}) ` +