mirror of
https://github.com/elk-zone/elk.git
synced 2024-09-06 04:09:10 +01:00
fix: fall back to votes count if voters count is not supplied (#1146)
This commit is contained in:
parent
d745bd0583
commit
9898a19358
1 changed files with 7 additions and 2 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue