From 9898a193587545081446f97025c0087a34536d6a Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Mon, 16 Jan 2023 09:57:32 +0000 Subject: [PATCH] fix: fall back to votes count if voters count is not supplied (#1146) --- components/status/StatusPoll.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/components/status/StatusPoll.vue b/components/status/StatusPoll.vue index abc466b6..3cf91f8e 100644 --- a/components/status/StatusPoll.vue +++ b/components/status/StatusPoll.vue @@ -28,13 +28,18 @@ async function vote(e: Event) { } poll.voted = true poll.votesCount++ - poll.votersCount = (poll.votersCount || 0) + 1 + + if (!poll.votersCount && poll.votesCount) + poll.votesCount = poll.votesCount + 1 + else + poll.votersCount = (poll.votersCount || 0) + 1 + cacheStatus({ ...status, poll }, undefined, true) await client.v1.polls.vote(poll.id, { choices }) } -const votersCount = $computed(() => poll.votersCount ?? 0) +const votersCount = $computed(() => poll.votersCount ?? poll.votesCount ?? 0)