From 706da8402eabf165f06454f6b99628d318024c51 Mon Sep 17 00:00:00 2001 From: Maxim Filippov Date: Thu, 4 Apr 2019 15:16:11 +0300 Subject: [PATCH] Round poll percentage --- src/components/poll/poll_status/poll_status.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/poll/poll_status/poll_status.vue b/src/components/poll/poll_status/poll_status.vue index 8c718262..dd0a2b17 100644 --- a/src/components/poll/poll_status/poll_status.vue +++ b/src/components/poll/poll_status/poll_status.vue @@ -32,7 +32,11 @@ export default { }, methods: { percentageForOption: function (count) { - return count / this.totalVotesCount * 100 + if (this.totalVotesCount === 0) { + return 0 + } + + return (count / this.totalVotesCount * 100).toFixed(1) } } }