From 271ba05aa1949ba1d21d11fb48379b20997eb910 Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Thu, 29 May 2025 10:42:34 +0300 Subject: [PATCH] =?UTF-8?q?fix=20[P-227]:=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB?= =?UTF-8?q?=D1=8C=D1=82=D0=B0=D1=82=D1=8B=20=D1=82=D0=B5=D1=81=D1=82=D0=B8?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D1=8F=20=D0=BF=D0=BE=D0=BB?= =?UTF-8?q?=D1=83=D1=87=D0=B0=D0=B5=D0=BC=20=D1=81=20=D0=B1=D1=8D=D0=BA?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/testing/BodyDetailTesting.vue | 1 - .../src/components/testing/DetailCardTest.vue | 10 +- .../src/components/testing/TestResults.vue | 155 +++++++++++++++--- src/front/src/views/TestHomePage.vue | 66 +++++--- 4 files changed, 182 insertions(+), 50 deletions(-) diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index aa54a694d..591dea355 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -13,7 +13,6 @@

-

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

{ const resp = await axiosApiInstance.get(`/api/tests/testdetail/${id}`); @@ -185,20 +186,17 @@ export default { const testMode = route.query.mode; const isFormalTesting = testMode === 'exam' || testMode === 'retry'; - console.log('Отправляем результаты теста:', answersToSubmit); - console.log('Режим тестирования:', isFormalTesting ? 'testing' : 'practice'); - const queryParams = new URLSearchParams(); if (isFormalTesting) { queryParams.append('status', 'testing'); } - await axiosApiInstance.post( + const response = await axiosApiInstance.post( `/api/tests/testresultview/?${queryParams.toString()}`, answersToSubmit, ); - console.log('Результаты теста успешно отправлены'); + testResults.value = response.data; } catch (error) { console.error('Ошибка при отправке результатов теста:', error); } @@ -238,7 +236,7 @@ export default { () => answers.value.filter((answer) => answer !== null).length, ); - const testPassed = computed(() => correctAnswers.value >= data?.value.questions.length / 2); + const testPassed = computed(() => testResults.value?.is_passed ?? false); const changeQuestion = (newIndex) => { if (newIndex >= 0 && newIndex < data?.value.questions.length) { diff --git a/src/front/src/components/testing/TestResults.vue b/src/front/src/components/testing/TestResults.vue index 5bafc51ba..f35d593fd 100644 --- a/src/front/src/components/testing/TestResults.vue +++ b/src/front/src/components/testing/TestResults.vue @@ -1,30 +1,46 @@