1
0
Fork 0

Fix percentage count for multiple-choice polls

This commit is contained in:
Lim Chee Aun 2022-12-14 17:56:08 +08:00
parent 410548603f
commit b883836f8a

View file

@ -287,8 +287,9 @@ function Poll({ poll }) {
{voted || expired ? ( {voted || expired ? (
options.map((option, i) => { options.map((option, i) => {
const { title, votesCount: optionVotesCount } = option; const { title, votesCount: optionVotesCount } = option;
const pollVotesCount = votersCount || votesCount;
const percentage = const percentage =
Math.round((optionVotesCount / votesCount) * 100) || 0; Math.round((optionVotesCount / pollVotesCount) * 100) || 0;
return ( return (
<div <div
class="poll-option" class="poll-option"