Correct poll results output for fractionals

This commit is contained in:
celestora 2022-10-11 19:31:21 +03:00
parent 1ad125210f
commit 226bbe03c3

View file

@ -103,7 +103,7 @@ class Poll extends Attachable
$option->name = $title;
$option->votes = $this->getVoterCount($id);
$option->pct = $result->totalVotes == 0 ? 0 : (($option->votes / $result->totalVotes) * 100);
$option->pct = $result->totalVotes == 0 ? 0 : min(100, floor(($option->votes / $result->totalVotes) * 100));
$option->voters = $this->getVoters($id, 1, 10);
if(!$user || !$voted)
$option->voted = NULL;