fix [P-227]: новый роут для результатов завершенных тестов

This commit is contained in:
Denis Voinovich committed 2025-05-30 14:00:31 +03:00
1 parent 562500a476
commit a78a21edf9
2 files changed
+14 -25

No files matched your search

@@ -12,17 +12,7 @@
</div> </div>
<div v-else class="result-animation error"> <div v-else class="result-animation error">
<v-icon size="64" color="error" class="shake">mdi-close-circle</v-icon> <v-icon size="64" color="error" class="shake">mdi-close-circle</v-icon>
<div class="text-h6 error--text mt-2 fade-in">Не расстраивайтесь!</div> <div class="text-h6 error--text mt-2 fade-in">Не пройдено</div>
<div class="text-body-1 error--text fade-in">Попробуйте еще раз</div>
<v-btn
v-if="isPracticeMode"
color="teal-darken-4"
class="mt-4 px-6"
@click="$emit('restart')"
>
Пройти заново
<v-icon class="ml-2">mdi-reload</v-icon>
</v-btn>
</div> </div>
</div> </div>
@@ -32,8 +22,6 @@
class="pa-4 text-center result-card" class="pa-4 text-center result-card"
elevation="2" elevation="2"
:color="testPassed ? 'success-light' : 'error-light'" :color="testPassed ? 'success-light' : 'error-light'"
:class="{ 'cursor-pointer': isPracticeMode }"
@click="showAnswersDialog = isPracticeMode"
> >
<v-icon size="36" :color="testPassed ? 'success' : 'error'" class="mb-2"> <v-icon size="36" :color="testPassed ? 'success' : 'error'" class="mb-2">
mdi-checkbox-marked-circle mdi-checkbox-marked-circle
@@ -63,8 +51,8 @@
</v-col> </v-col>
</v-row> </v-row>
<!-- Модальное окно с правильными ответами --> <!-- Модальное окно с правильными ответами отображается только в режиме тренировки -->
<v-dialog v-model="showAnswersDialog" max-width="600" v-if="isPracticeMode"> <v-dialog v-if="isPracticeMode" v-model="showAnswersDialog" max-width="600">
<v-card> <v-card>
<v-card-title class="d-flex align-center text-h6 font-weight-bold px-4 py-3 bg-teal-darken-4 text-white"> <v-card-title class="d-flex align-center text-h6 font-weight-bold px-4 py-3 bg-teal-darken-4 text-white">
<span>Правильные ответы</span> <span>Правильные ответы</span>
+11 -10
View File
@@ -382,18 +382,19 @@ export default {
const showResults = async (id) => { const showResults = async (id) => {
try { try {
const response = await axiosApiInstance.get(`/api/tests/testdetail/${id}/`); const [testDetailResponse, resultResponse] = await Promise.all([
axiosApiInstance.get(`/api/tests/testdetail/${id}/`),
axiosApiInstance.get(`/api/tests/testresultview/?id=${id}`)
]);
testResults.value = { testResults.value = {
passed: true, passed: resultResponse.data.is_passed,
total_questions: response.data.question_count, total_questions: testDetailResponse.data.question_count,
total_answers: response.data.question_count, total_answers: resultResponse.data.answered_questions_total,
correct_answers: Math.ceil((response.data.pass_perc / 100) * response.data.question_count), correct_answers: resultResponse.data.score,
time_spent: `${response.data.time} мин`, time_spent: `${testDetailResponse.data.time} мин`,
questions: response.data.questions, questions: [],
user_answers: response.data.questions.map(q => userAnswers: []
q.answers.find(a => a.right_wrong)?.name || []
)
}; };
showResultsDialog.value = true; showResultsDialog.value = true;