diff --git a/src/front/src/components/testing/QuestionBlock.vue b/src/front/src/components/testing/QuestionBlock.vue index c0a419f33..5d6cd7343 100644 --- a/src/front/src/components/testing/QuestionBlock.vue +++ b/src/front/src/components/testing/QuestionBlock.vue @@ -38,6 +38,7 @@
+

Возможно несколько верных ответов

- + Результаты тестирования @@ -120,6 +120,10 @@ import { useRoute } from 'vue-router'; export default { emits: ['restart'], props: { + hideTitle: { + type: Boolean, + default: false + }, testFinished: Boolean, testPassed: Boolean, correctAnswers: Number, diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index fab353619..0719e40ae 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -425,6 +425,12 @@ export default { const errorMessage = ref(''); const validateAnswers = () => { + if (props.isTest) { + return form.value.questions.some((question) => { + const hasCorrectAnswer = question.answers.some(answer => answer.right_wrong); + return !hasCorrectAnswer || question.answers.some(answer => !answer.text || answer.text.trim() === ''); + }); + } return form.value.questions.some((question) => { if (question.settings.choice === 'free') { return question.answers.some((answer) => !answer.text || answer.text.trim() === ''); @@ -436,6 +442,15 @@ export default { const saveVoting = async () => { try { if (props.isTest) { + const invalidQuestions = form.value.questions.filter(question => + !question.answers.some(answer => answer.right_wrong) + ); + + if (invalidQuestions.length > 0) { + alert('Каждый вопрос должен иметь хотя бы один правильный ответ'); + return; + } + const testData = { name: form.value.title, description: form.value.description, diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index d5496b267..095728963 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -164,22 +164,22 @@ - - + - +