Fix pelmeni moment

This commit is contained in:
celestora 2022-10-11 19:34:28 +03:00 committed by GitHub
parent f2ca6be4d5
commit 5203229e9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;