From d8ed8e78b70df2ee22eb60f39c0813229f009144 Mon Sep 17 00:00:00 2001
From: Denzel
Date: Tue, 21 Jan 2025 15:42:03 +0300
Subject: [PATCH] ref
---
src/front/src/components/vote/VoteResult.vue | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/front/src/components/vote/VoteResult.vue b/src/front/src/components/vote/VoteResult.vue
index 972a73e26..bf85f21bb 100644
--- a/src/front/src/components/vote/VoteResult.vue
+++ b/src/front/src/components/vote/VoteResult.vue
@@ -26,7 +26,6 @@
-
{{ question.name }}
@@ -56,6 +55,13 @@
Должность: {{ answer.employee ? answer.employee.post : '' }}
+
@@ -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
};
},
};