mirror of
https://github.com/openvk/openvk
synced 2024-12-23 00:51:03 +03:00
Correct poll results output for fractionals
This commit is contained in:
parent
1ad125210f
commit
226bbe03c3
1 changed files with 1 additions and 1 deletions
|
@ -103,7 +103,7 @@ class Poll extends Attachable
|
||||||
$option->name = $title;
|
$option->name = $title;
|
||||||
|
|
||||||
$option->votes = $this->getVoterCount($id);
|
$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);
|
$option->voters = $this->getVoters($id, 1, 10);
|
||||||
if(!$user || !$voted)
|
if(!$user || !$voted)
|
||||||
$option->voted = NULL;
|
$option->voted = NULL;
|
||||||
|
|
Loading…
Reference in a new issue