This commit is contained in:
Denzel committed 2025-01-21 15:42:03 +03:00
1 parent 5578062bc8
commit d8ed8e78b7
1 file changed
+14 -2
+14 -2
View File
@@ -26,7 +26,6 @@
<v-tabs-window v-model="activeTab">
<v-tabs-window-item v-for="(question, questionIndex) in questions" :key="questionIndex">
<v-row>
<!-- Победитель -->
<v-col cols="12">
<h3 class="text-center">{{ question.name }}</h3>
<v-card-title class="d-flex ga-2 align-center">
@@ -56,6 +55,13 @@
<small>Должность: {{ answer.employee ? answer.employee.post : '' }}</small>
</template>
</p>
<v-progress-linear
:model-value="getPercentage(answer.count, question)"
height="10"
color="teal-darken-4"
striped
rounded
/>
</v-list-item>
</v-list>
</v-card-text>
@@ -114,6 +120,11 @@ export default {
return currentVote
}
const getPercentage = (count, question) => {
const totalVotes = question.answers.reduce((sum, answer) => sum + answer.count, 0);
return totalVotes > 0 ? (count / totalVotes) * 100 : 0;
};
return {
activeTab,
questions,
@@ -123,7 +134,8 @@ export default {
shouldShowTooltip,
voteCount,
title,
description
description,
getPercentage
};
},
};