реф результатов (одни голоса, одни места)

This commit is contained in:
Denzel committed 2025-01-24 14:29:55 +03:00
1 parent 59eb528db8
commit 9673fdacfa
1 file changed
+17 -4
+17 -4
View File
@@ -1,5 +1,5 @@
<template>
<v-container style="height: 85vh">
<v-container style="height: 85vh;">
<div class="text-end">
<v-btn class="" color="red-darken-1" density="compact" icon="mdi-close-thick" size="small"
@click="$emit('closer')">
@@ -172,9 +172,8 @@
v-for="(answer, index) in activeDepartmentResults.filter(el => el.count > 0)"
:key="index"
>
<p>
<strong class="mr-4">{{ index + 1 }}.</strong>
<strong class="mr-4">{{ index + 1 }}.</strong>
<v-avatar v-if="answer.file === null && answer.employee"
:image="checkremote(`${spravURL()}${answer.employee.login}.jpg`)"
class="cursor-pointer"
@@ -272,7 +271,21 @@ export default {
};
const getTopResults = (question) => {
return [...question?.answers].sort((a, b) => b.count - a.count);
const sortedAnswers = [...question.answers].sort((a, b) => b.count - a.count);
// Присваиваем одинаковые индексы для одинаковых значений count
let rank = 1;
let previousCount = null;
return sortedAnswers.map((answer, index) => {
if (answer.count !== previousCount) {
rank = index + 1;
previousCount = answer.count;
}
return {
...answer,
rank
};
});
};
const truncateText = (text, maxLength) => {