From 5203229e9e1c66ec36aaa3daafd1c46856bb0b92 Mon Sep 17 00:00:00 2001 From: celestora Date: Tue, 11 Oct 2022 19:34:28 +0300 Subject: [PATCH] Fix pelmeni moment --- Web/Models/Entities/Poll.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Web/Models/Entities/Poll.php b/Web/Models/Entities/Poll.php index 43a97074..ccb4d3b2 100644 --- a/Web/Models/Entities/Poll.php +++ b/Web/Models/Entities/Poll.php @@ -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; @@ -292,4 +292,4 @@ class Poll extends Attachable ]); } } -} \ No newline at end of file +}