feat [P-227]: дата окончания для каждого из сотрудников
This commit is contained in:
1 parent
04840193e2
commit
332260113c
2 files changed
+18
-6
No files matched your search
@@ -56,7 +56,12 @@
|
||||
>
|
||||
<template #title>
|
||||
<div class="d-flex align-center">
|
||||
<span class="text-orange-darken-2">{{ employee.fio }}</span>
|
||||
<div>
|
||||
<span class="text-orange-darken-2">{{ employee.fio }}</span>
|
||||
<div class="text-caption text-grey-darken-1" v-if="employee.completion_date">
|
||||
Дата окончания: {{ new Date(employee.completion_date).toLocaleDateString('ru-RU') }}
|
||||
</div>
|
||||
</div>
|
||||
<v-btn
|
||||
icon="mdi-close"
|
||||
variant="text"
|
||||
|
||||
@@ -276,17 +276,24 @@ export default {
|
||||
const response = await getTestToUser(id);
|
||||
console.log('Получены назначения теста:', response);
|
||||
|
||||
const uniqueAssignments = response.reduce((acc, testing) => {
|
||||
if (testing.user_details && testing.is_active && !acc.some(a => a.id === testing.user_details.id)) {
|
||||
acc.push(testing.user_details);
|
||||
// Сгруппируем тесты по пользователям и возьмем самую позднюю дату для каждого
|
||||
const assignmentsByUser = response.reduce((acc, testing) => {
|
||||
if (testing.user_details && testing.is_active) {
|
||||
const existingUser = acc.find(u => u.id === testing.user_details.id);
|
||||
if (!existingUser) {
|
||||
acc.push({
|
||||
...testing.user_details,
|
||||
completion_date: testing.completion_date
|
||||
});
|
||||
}
|
||||
}
|
||||
return acc;
|
||||
}, []);
|
||||
|
||||
assignedEmployees.value = uniqueAssignments.map(user => user.id);
|
||||
assignedEmployees.value = assignmentsByUser.map(user => user.id);
|
||||
console.log('ID назначенных сотрудников:', assignedEmployees.value);
|
||||
|
||||
assignedEmployeesDetails.value = uniqueAssignments.sort((a, b) => a.fio.localeCompare(b.fio));
|
||||
assignedEmployeesDetails.value = assignmentsByUser.sort((a, b) => a.fio.localeCompare(b.fio));
|
||||
console.log('Детали назначенных сотрудников:', assignedEmployeesDetails.value);
|
||||
|
||||
} catch (error) {
|
||||
|
||||
Reference in new issue
Block a user