fix width if no voter
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div class="emphased">
|
||||
<div v-for="(amount, val) in filtered_results" :id="`${questionId}-${val}`" :key="val"
|
||||
:style="{ width: `${(amount / total) * 100}%`, background: colors[values.indexOf(String(val))] }">
|
||||
:style="{ width: (total ? `${(amount / total) * 100}%` : '100%'), background: colors[values.indexOf(String(val))] }">
|
||||
<span>({{ amount }}){{ val }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,7 +40,7 @@ const filtered_results = computed(() => {
|
||||
|
||||
})
|
||||
|
||||
const total = computed(() => Object.values(filtered_results.value).reduce((acc, v) => v + acc, 0) ?? 1)
|
||||
const total = computed(() => (Object.values(filtered_results.value).reduce((acc, v) => v + acc, 0) || 0))
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user