mirror of
https://github.com/cheeaun/phanpy.git
synced 2024-11-24 02:05:39 +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 ? (
|
||||
options.map((option, i) => {
|
||||
const { title, votesCount: optionVotesCount } = option;
|
||||
const percentage = Math.round((optionVotesCount / votesCount) * 100);
|
||||
const percentage =
|
||||
Math.round((optionVotesCount / votesCount) * 100) || 0;
|
||||
return (
|
||||
<div
|
||||
class="poll-option"
|
||||
|
|
Loading…
Reference in a new issue