From 4a454523459ef98827849baeaa06338798f65a9d Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Thu, 29 May 2025 09:16:20 +0300 Subject: [PATCH] =?UTF-8?q?fix=20[P-227]:=20=D0=BD=D0=B0=D0=B7=D0=BD=D0=B0?= =?UTF-8?q?=D1=87=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/testing/AssignTestDialog.vue | 172 ++++++++++++++++++ .../components/testing/BodyDetailTesting.vue | 3 - src/front/src/utils/axios-api.js | 13 +- src/front/src/views/TestHomePage.vue | 120 ++++-------- 4 files changed, 211 insertions(+), 97 deletions(-) create mode 100644 src/front/src/components/testing/AssignTestDialog.vue diff --git a/src/front/src/components/testing/AssignTestDialog.vue b/src/front/src/components/testing/AssignTestDialog.vue new file mode 100644 index 000000000..b07df9347 --- /dev/null +++ b/src/front/src/components/testing/AssignTestDialog.vue @@ -0,0 +1,172 @@ + + + diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index 38fd63104..aa54a694d 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -11,9 +11,6 @@

Время на прохождение — {{ data?.time }} минут

-

- Срок окончания — {{ new Date(data?.dateend).toLocaleDateString() }} -

Попытка 1 из {{ data?.attemps_number }}

diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 015dd44ca..3ad402c9f 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -244,16 +244,19 @@ async function createTest(testData) { } } -async function assignTest(testId, employeeIds) { +async function assignTest(testId, employeeIds, completionDate) { try { - const testDetails = await getTestDetail(testId); - const completion_date = testDetails.dateend; + if (!completionDate) { + // If no completion date provided, get it from test details + const testDetails = await getTestDetail(testId); + completionDate = testDetails.dateend; + } const userIds = Array.from(employeeIds).map(id => Number(id)); console.log('Назначение теста для пользователей:', userIds); const promises = userIds.map(userId => - assignTestToUser(userId, testId, completion_date) + assignTestToUser(userId, testId, completionDate) ); await Promise.all(promises); @@ -303,7 +306,7 @@ async function assignTestToUser(userId, testId, completionDate) { const response = await axiosApiInstance.post('/api/tests/testingview/', { user_id: Number(userId), test_id: Number(testId), - completion_date: new Date(completionDate).toISOString() + completion_date: completionDate }); return response.data; } catch (error) { diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 164917116..79b6ba41f 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -37,14 +37,19 @@