Skip to content

Commit

Permalink
Merge pull request #1247 from PyPlanet/feature/1246
Browse files Browse the repository at this point in the history
Voting: ceil needed votes for vote to pass.
  • Loading branch information
TheMaximum committed Aug 23, 2023
2 parents 739d2eb + b36a466 commit e3533b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pyplanet/apps/contrib/voting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
import datetime
import logging
import math

from pyplanet.apps.config import AppConfig
from pyplanet.apps.core.maniaplanet import callbacks as mp_signals
Expand Down Expand Up @@ -788,7 +789,7 @@ async def create_vote(self, action, player, passed_event):
new_vote.action = action
new_vote.requester = player
new_vote.votes_current = []
needed_votes = round(players * ratio)
needed_votes = math.ceil(players * ratio)
if needed_votes > players:
needed_votes = players
new_vote.votes_required = needed_votes
Expand Down

0 comments on commit e3533b9

Please sign in to comment.