fix [P-227]: новый роут для результатов завершенных тестов
This commit is contained in:
1 parent
562500a476
commit
a78a21edf9
2 files changed
+14
-25
No files matched your search
@@ -12,17 +12,7 @@
|
||||
</div>
|
||||
<div v-else class="result-animation error">
|
||||
<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-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 class="text-h6 error--text mt-2 fade-in">Не пройдено</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -32,8 +22,6 @@
|
||||
class="pa-4 text-center result-card"
|
||||
elevation="2"
|
||||
:color="testPassed ? 'success-light' : 'error-light'"
|
||||
:class="{ 'cursor-pointer': isPracticeMode }"
|
||||
@click="showAnswersDialog = isPracticeMode"
|
||||
>
|
||||
<v-icon size="36" :color="testPassed ? 'success' : 'error'" class="mb-2">
|
||||
mdi-checkbox-marked-circle
|
||||
@@ -63,8 +51,8 @@
|
||||
</v-col>
|
||||
</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-title class="d-flex align-center text-h6 font-weight-bold px-4 py-3 bg-teal-darken-4 text-white">
|
||||
<span>Правильные ответы</span>
|
||||
|
||||
@@ -382,18 +382,19 @@ export default {
|
||||
|
||||
const showResults = async (id) => {
|
||||
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 = {
|
||||
passed: true,
|
||||
total_questions: response.data.question_count,
|
||||
total_answers: response.data.question_count,
|
||||
correct_answers: Math.ceil((response.data.pass_perc / 100) * response.data.question_count),
|
||||
time_spent: `${response.data.time} мин`,
|
||||
questions: response.data.questions,
|
||||
user_answers: response.data.questions.map(q =>
|
||||
q.answers.find(a => a.right_wrong)?.name || []
|
||||
)
|
||||
passed: resultResponse.data.is_passed,
|
||||
total_questions: testDetailResponse.data.question_count,
|
||||
total_answers: resultResponse.data.answered_questions_total,
|
||||
correct_answers: resultResponse.data.score,
|
||||
time_spent: `${testDetailResponse.data.time} мин`,
|
||||
questions: [],
|
||||
userAnswers: []
|
||||
};
|
||||
|
||||
showResultsDialog.value = true;
|
||||
|
||||
Reference in new issue
Block a user