Skip to content

Commit

Permalink
fix: fall back to votes count if voters count is not supplied (#1146)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jan 16, 2023
1 parent d745bd0 commit 9898a19
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions components/status/StatusPoll.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</script>

<template>
Expand Down

0 comments on commit 9898a19

Please sign in to comment.