Round poll percentage
This commit is contained in:
parent
93aedd6fd7
commit
706da8402e
|
@ -32,7 +32,11 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
percentageForOption: function (count) {
|
percentageForOption: function (count) {
|
||||||
return count / this.totalVotesCount * 100
|
if (this.totalVotesCount === 0) {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return (count / this.totalVotesCount * 100).toFixed(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue