mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-24 10:15:37 +03:00
Fix poll percentage showing NaN
This happens when votes are still 0, so 0 divide by 0
This commit is contained in:
parent
975f3dd33f
commit
d4cdf2435f
1 changed files with 2 additions and 1 deletions
|
@ -287,7 +287,8 @@ 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 percentage = Math.round((optionVotesCount / votesCount) * 100);
|
const percentage =
|
||||||
|
Math.round((optionVotesCount / votesCount) * 100) || 0;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class="poll-option"
|
class="poll-option"
|
||||||
|
|
Loading…
Reference in a new issue