From 68487575e53fb002187546e4b80b59bf061eb7bb Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Wed, 4 Jun 2025 14:56:02 +0300 Subject: [PATCH 01/14] =?UTF-8?q?fix=20[P-256]:=20=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/testing/BodyDetailTesting.vue | 16 +++++++++++- .../src/components/testing/DetailCardTest.vue | 25 +++++++++++++++++-- src/front/src/utils/axios-api.js | 13 ++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index a9f139cab..74e3e7149 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -36,7 +36,7 @@
- Количество попыток: {{ data?.attemps_number }} + Количество попыток: {{ remainingAttempts !== undefined ? remainingAttempts : data?.attemps_number }}
@@ -50,12 +50,22 @@ {{ isExamMode ? 'Начать' : 'Тренироваться' }} + + Все попытки израсходованы + @@ -75,6 +85,10 @@ export default { isDialog: { type: Boolean, default: false + }, + remainingAttempts: { + type: Number, + default: undefined } }, setup(props) { diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue index 35e346983..5211aab7c 100644 --- a/src/front/src/components/testing/DetailCardTest.vue +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -12,7 +12,7 @@ /> - + { const minutes = Math.floor(spentTime.value / 60); @@ -90,10 +91,23 @@ export default { }); const getTestById = async (id) => { + // Загружаем детали теста из API testdetail const resp = await axiosApiInstance.get(`/api/tests/testdetail/${id}`); data.value = resp.data; try { + // Проверяем оставшиеся попытки из API gettests со статусом active + const activeTest = await getActiveTest(id); + + // Если нашли тест в активных, проверяем количество попыток + if (activeTest) { + remainingAttempts.value = activeTest.attemps_number; + } else { + // Если тест не найден в активных, устанавливаем 0 попыток + remainingAttempts.value = 0; + } + + // Получаем данные о назначениях теста const testingResp = await axiosApiInstance.get(`/api/tests/testingview/?test_id=${id}`); const userTestings = testingResp.data; if (userTestings?.length > 0) { @@ -133,6 +147,12 @@ export default { const startTest = async () => { await getTestById(testId); + // Проверяем, есть ли оставшиеся попытки + if (remainingAttempts.value !== undefined && remainingAttempts.value <= 0) { + console.log('Нет оставшихся попыток для прохождения теста'); + return; // Прерываем запуск теста если попыток не осталось + } + testStarted.value = true; testFinished.value = false; @@ -274,6 +294,7 @@ export default { answeredQuestions, testPassed, data, + remainingAttempts, }; }, }; diff --git a/src/front/src/utils/axios-api.js b/src/front/src/utils/axios-api.js index 9b64e4a45..eb69c83ea 100644 --- a/src/front/src/utils/axios-api.js +++ b/src/front/src/utils/axios-api.js @@ -368,6 +368,18 @@ async function deleteTestingRecord(testingId) { } } +async function getActiveTest(id) { + try { + const response = await axiosApiInstance.get(`/api/tests/gettests/?status=active`); + const activeTests = response.data; + const activeTest = activeTests.find(test => test.id === Number(id)); + return activeTest || null; + } catch (error) { + console.error("Ошибка получения активного теста:", error); + throw error; + } +} + export { axiosApiInstance, @@ -392,4 +404,5 @@ export { assignTestToUser, getTestToUser, deleteTestingRecord, + getActiveTest, } From 8860201d5e02e495d7eebb9db80b4c96f6e8284b Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Wed, 4 Jun 2025 16:35:01 +0300 Subject: [PATCH 02/14] =?UTF-8?q?fix=20[P-256]:=20=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=20=D0=B3=D0=BB=D0=B0=D0=B2=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82?= =?UTF-8?q?=D1=80=D0=B0=D0=BD=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/carousel-list.vue | 6 ++++++ src/front/src/components/digital-letna.vue | 10 ++++++++++ src/front/src/views/HomePage.vue | 16 +++++++++++++--- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/src/front/src/components/carousel-list.vue b/src/front/src/components/carousel-list.vue index f6b966916..958495371 100644 --- a/src/front/src/components/carousel-list.vue +++ b/src/front/src/components/carousel-list.vue @@ -187,3 +187,9 @@ export default { cursor: default !important; } + diff --git a/src/front/src/components/digital-letna.vue b/src/front/src/components/digital-letna.vue index f550fdf4d..e3a6f6f15 100644 --- a/src/front/src/components/digital-letna.vue +++ b/src/front/src/components/digital-letna.vue @@ -234,4 +234,14 @@ export default { .fiction .v-input__control { display: none; } + + + \ No newline at end of file diff --git a/src/front/src/views/HomePage.vue b/src/front/src/views/HomePage.vue index 8c7ff94ac..530091b99 100644 --- a/src/front/src/views/HomePage.vue +++ b/src/front/src/views/HomePage.vue @@ -146,12 +146,22 @@ export default { } .bgCard { - /* #ffffff6b #ffffff8c*/ - background: #ffffff38; + background: #fff !important; } .bgText { - background: #ffffffb0; + background: #f5f5f5 !important; + color: #222 !important; line-height: 2.1rem !important; } + +.card-unified { + border-radius: 18px; + box-shadow: none; +} + +.text-unified { + color: #222 !important; + font-family: 'Montserrat', 'Arial', sans-serif; +} From 01b5be0e187236a88fdc4d5220061252a76c7a77 Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Wed, 4 Jun 2025 16:40:17 +0300 Subject: [PATCH 03/14] =?UTF-8?q?fix=20[P-256]:=20=D1=84=D0=B8=D0=BA=D1=81?= =?UTF-8?q?=20=D1=82=D0=B5=D1=81=D1=82=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/testing/BodyDetailTesting.vue | 4 ++-- src/front/src/components/testing/DetailCardTest.vue | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index 74e3e7149..9020fc7fa 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -33,7 +33,7 @@ -
+
Количество попыток: {{ remainingAttempts !== undefined ? remainingAttempts : data?.attemps_number }} @@ -50,7 +50,7 @@ { await getTestById(testId); - // Проверяем, есть ли оставшиеся попытки - if (remainingAttempts.value !== undefined && remainingAttempts.value <= 0) { + // Проверяем попытки только для режима экзамена + const isExamMode = route.query.mode === 'exam'; + if (isExamMode && remainingAttempts.value !== undefined && remainingAttempts.value <= 0) { console.log('Нет оставшихся попыток для прохождения теста'); return; // Прерываем запуск теста если попыток не осталось } From 122bd670527aa7e323952adfc7a3b8bd92dfcead Mon Sep 17 00:00:00 2001 From: Denis Voinovich Date: Wed, 4 Jun 2025 17:01:27 +0300 Subject: [PATCH 04/14] =?UTF-8?q?fix=20[P-256]:=20=D0=B3=D0=BB=D0=B0=D0=B2?= =?UTF-8?q?=D0=BD=D0=BE=D0=B9=20=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B8=D1=86?= =?UTF-8?q?=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/front/src/components/UI/NewsCard.vue | 7 +++++-- src/front/src/components/UI/fiousercard/listUser.vue | 8 +++++--- src/front/src/components/UI/my-helper.vue | 2 +- src/front/src/components/carousel-list.vue | 2 +- src/front/src/components/digital-letna.vue | 4 ++-- src/front/src/components/news-full.vue | 6 +++++- src/front/src/components/news-home.vue | 2 +- src/front/src/views/HomePage.vue | 4 ++-- 8 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/front/src/components/UI/NewsCard.vue b/src/front/src/components/UI/NewsCard.vue index c956a7d6c..c16d25ce7 100644 --- a/src/front/src/components/UI/NewsCard.vue +++ b/src/front/src/components/UI/NewsCard.vue @@ -41,6 +41,7 @@ @@ -53,6 +54,7 @@ @@ -65,6 +67,7 @@ @@ -76,6 +79,7 @@ @@ -102,8 +106,7 @@ @@ -23,16 +24,17 @@ v-if="from_which == 'top-user'" class="h-100 text-left pa-0 pl-0" @click="open = true" + active-color="teal-darken-4" > diff --git a/src/front/src/components/UI/my-helper.vue b/src/front/src/components/UI/my-helper.vue index 85df72a3a..eb45ddb76 100644 --- a/src/front/src/components/UI/my-helper.vue +++ b/src/front/src/components/UI/my-helper.vue @@ -11,7 +11,7 @@ v-bind="attrs" v-on="on" size="large" - color="indigo" + color="teal-darken-4" icon="mdi-owl" @click="menu = !menu" > diff --git a/src/front/src/components/carousel-list.vue b/src/front/src/components/carousel-list.vue index 958495371..1df2878e7 100644 --- a/src/front/src/components/carousel-list.vue +++ b/src/front/src/components/carousel-list.vue @@ -9,7 +9,7 @@ hide-delimiters hide-delimiter-background :show-arrows="carous.length < 2 ? false : 'hover'" - color="white" + color="teal-darken-4" @update:modelValue="slidechanged" > + - - + + Выбраны все {{ question.answers.length }} сотрудников + + +
{{ findEmployeeById(person.text)?.fio }} @@ -158,7 +184,7 @@ import QuestionHeader from '@/components/vote/ConstructorVote/QuestionHeader.vue'; import QuestionSettings from '@/components/vote/ConstructorVote/QuestionSettings.vue'; import AnswerList from '@/components/vote/ConstructorVote/AnswerList.vue'; -import { computed, ref } from 'vue'; +import { computed, ref, watch } from 'vue'; import { useRoute } from 'vue-router'; export default { @@ -295,11 +321,55 @@ export default { }; const onEmployeeUpdate = (selected) => { + // Filter existing answers to keep only those that are still selected props.question.answers = props.question.answers.filter((e) => selected.includes(e.text) ); + + // Add new answers for newly selected employees that don't have answers yet + const existingAnswerIds = props.question.answers.map(a => a.text); + const newEmployeeIds = selected.filter(id => !existingAnswerIds.includes(id)); + + // Add new answers for the newly selected employees + newEmployeeIds.forEach(employeeId => { + props.question.answers.push({ text: employeeId, image: null }); + }); + + // Also update the saved state for potential future switching between radio options + props.question._savedSelectedEmployees = [...selected]; + props.question._savedAnswers = [...props.question.answers]; + emit('update:question', props.question); }; + + const removeSelectedEmployee = (employeeId) => { + // Находим индекс сотрудника в массиве selectedEmployees + const index = props.question.selectedEmployees.indexOf(employeeId); + if (index !== -1) { + // Удаляем сотрудника из списка выбранных + props.question.selectedEmployees.splice(index, 1); + // Находим соответствующий ответ и удаляем его + const answerIndex = props.question.answers.findIndex(a => a.text === employeeId); + if (answerIndex !== -1) { + props.question.answers.splice(answerIndex, 1); + } + + // Обновляем сохраненное состояние + if (props.question._savedSelectedEmployees) { + const savedIndex = props.question._savedSelectedEmployees.indexOf(employeeId); + if (savedIndex !== -1) { + props.question._savedSelectedEmployees.splice(savedIndex, 1); + } + + const savedAnswerIndex = props.question._savedAnswers?.findIndex(a => a.text === employeeId); + if (savedAnswerIndex !== -1) { + props.question._savedAnswers.splice(savedAnswerIndex, 1); + } + } + + emit('update:question', props.question); + } + }; const toggleSelectAll = (value) => { props.handleSelectAll(value, props.index); @@ -307,8 +377,21 @@ export default { }; const removeEmployeeAnswer = (pIndex) => { - props.question.selectedEmployees.splice(pIndex, 1); + const employeeId = props.question.answers[pIndex].text; + + props.question.selectedEmployees = props.question.selectedEmployees.filter(id => id !== employeeId); props.question.answers.splice(pIndex, 1); + + // Обновляем сохраненное состояние + if (props.question._savedSelectedEmployees) { + props.question._savedSelectedEmployees = props.question._savedSelectedEmployees.filter(id => id !== employeeId); + + const savedAnswerIndex = props.question._savedAnswers?.findIndex(a => a.text === employeeId); + if (savedAnswerIndex !== -1) { + props.question._savedAnswers.splice(savedAnswerIndex, 1); + } + } + emit('update:question', props.question); }; @@ -320,6 +403,27 @@ export default { const isTestRoute = computed(() => { return route.path && String(route.path).includes('test'); }); + + // Добавляем наблюдение за изменением выбора типа голосования + watch(() => props.question.settings.onlyDep, (newValue, oldValue) => { + // Если выбрано любое значение кроме null, автоматически выбрать всех сотрудников + if (newValue !== null) { + // Сохраняем выбранных сотрудников перед выбором "все" + if (oldValue === null) { + // Сохраняем текущий выбор сотрудников для возможного возврата к "произвольным сотрудникам" + props.question._savedSelectedEmployees = [...props.question.selectedEmployees]; + props.question._savedAnswers = [...props.question.answers]; + } + toggleSelectAll(true); + } + // Если переключаемся на "За произвольного сотрудника" (null) и у нас есть сохраненный выбор + else if (newValue === null && oldValue !== null && props.question._savedSelectedEmployees) { + // Восстанавливаем ранее сохраненный выбор сотрудников + props.question.selectedEmployees = [...props.question._savedSelectedEmployees]; + props.question.answers = [...props.question._savedAnswers]; + emit('update:question', props.question); + } + }); return { resetAnswers, @@ -328,6 +432,7 @@ export default { onEmployeeUpdate, toggleSelectAll, removeEmployeeAnswer, + removeSelectedEmployee, onEmployeesChange, isTestRoute, questionImagePreview, diff --git a/src/front/src/components/vote/CurrentVote.vue b/src/front/src/components/vote/CurrentVote.vue index ac912ae59..c93af7807 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -234,10 +234,10 @@ export default { activepick.value = val } - const groupedAnswers = (question) => { + const groupedAnswers = (question) => { const filtered = question.answers.filter(answer => answer.employee?.id !== accountStore.user.is_idEmployee); - if (question.settings.onlyDep === null) { + if (question.settings.onlyDep === null || question.settings.onlyDep === 'any') { return groupByDepartment(filtered); } else if (question.settings.onlyDep) { const byDepartment = filtered.filter( diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index 04620f8eb..a0dd4d783 100644 --- a/src/front/src/components/vote/VoteConstructor.vue +++ b/src/front/src/components/vote/VoteConstructor.vue @@ -263,12 +263,17 @@ Голосование по отделам: {{ onlyDepdict.find((e) => e.value === question.settings.onlyDep).name }}
-

Выбранные сотрудники:

-
    -
  • - {{ findEmployeeById(employeeId.text).fio }} -
  • -
+
+

Выбрано {{ question.answers.length }} сотрудников

+
+
+

Выбранные сотрудники:

+
    +
  • + {{ findEmployeeById(employeeId.text).fio }} +
  • +
+
@@ -627,12 +632,13 @@ export default { }; const onlyDepdict = [ - { name: 'За любого сотрудника', value: null }, + { name: 'За любого сотрудника', value: 'any' }, { - name: 'Кроме своего отдела', + name: 'Только за сотрудника из другого отдела', value: false, }, - { name: 'Только за свой отдел', value: true }, + { name: 'Только за сотрудника из своего отдела', value: true }, + { name: 'За произвольного сотрудника (есть возможность добавить картинку)', value: null }, ]; const quests = computed(() => form.value.questions.map((question) => question.text.length > 0)); diff --git a/src/front/src/components/vote/VoteResult.vue b/src/front/src/components/vote/VoteResult.vue index 744a5f365..906bdbbed 100644 --- a/src/front/src/components/vote/VoteResult.vue +++ b/src/front/src/components/vote/VoteResult.vue @@ -30,7 +30,7 @@ - + Date: Thu, 19 Jun 2025 10:00:47 +0300 Subject: [PATCH 12/14] =?UTF-8?q?fix=20[P-276]:=20=D0=B8=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BB=D0=BE=D0=B3=D0=B8=D0=BA?= =?UTF-8?q?=D0=B8=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=D1=8F=20=D1=81=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD=D0=B8=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B2=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80?= =?UTF-8?q?=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vote/ConstructorVote/QuestionItem.vue | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/src/front/src/components/vote/ConstructorVote/QuestionItem.vue b/src/front/src/components/vote/ConstructorVote/QuestionItem.vue index 4dd05e7c4..d911358ac 100644 --- a/src/front/src/components/vote/ConstructorVote/QuestionItem.vue +++ b/src/front/src/components/vote/ConstructorVote/QuestionItem.vue @@ -59,15 +59,6 @@ - - Все сотрудники будут автоматически добавлены в варианты ответов - - - Выбраны все {{ question.answers.length }} сотрудников -
Date: Thu, 19 Jun 2025 10:07:10 +0300 Subject: [PATCH 13/14] =?UTF-8?q?fix=20[P-272]:=20=D1=83=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=20=D0=BB=D0=B8=D1=88=D0=BD=D0=B8=D0=B5=20=D1=83?= =?UTF-8?q?=D0=B2=D0=B5=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__pycache__/0001_initial.cpython-310.pyc | Bin 2938 -> 2938 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 138 -> 138 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 2011 -> 2011 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 130 -> 130 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 3061 -> 3061 bytes ...0002_alter_calendar_author.cpython-310.pyc | Bin 781 -> 781 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 140 -> 140 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 4797 -> 4797 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 133 -> 133 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 2121 -> 2121 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 138 -> 138 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 5118 -> 5118 bytes .../0002_news_vote.cpython-310.pyc | Bin 491 -> 491 bytes .../0003_news_vote.cpython-310.pyc | Bin 688 -> 688 bytes .../0004_remove_news_vote.cpython-310.pyc | Bin 491 -> 491 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 132 -> 132 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 1888 -> 1888 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 128 -> 128 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 3660 -> 3660 bytes ...est_dateend_test_datestart.cpython-310.pyc | Bin 457 -> 457 bytes .../0003_testing_is_active.cpython-310.pyc | Bin 632 -> 632 bytes .../0004_test_is_available.cpython-310.pyc | Bin 608 -> 608 bytes ...ing_datestart_testing_news.cpython-310.pyc | Bin 958 -> 958 bytes ...on_alter_testresult_answer.cpython-310.pyc | Bin 840 -> 840 bytes ...testing_alter_testing_user.cpython-310.pyc | Bin 942 -> 942 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 127 -> 127 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 5403 -> 5403 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 130 -> 130 bytes .../__pycache__/0001_initial.cpython-310.pyc | Bin 575 -> 575 bytes .../__pycache__/0002_initial.cpython-310.pyc | Bin 2345 -> 2345 bytes .../0003_vote_news.cpython-310.pyc | Bin 730 -> 730 bytes .../__pycache__/__init__.cpython-310.pyc | Bin 126 -> 126 bytes 32 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/back/about_inspection/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/about_inspection/migrations/__pycache__/0001_initial.cpython-310.pyc index 5e1baa6e5ae180b4d9cce29c932590efcf3bd0a3..e911c828ed92a46db3fabc5aff032f163b158d0d 100644 GIT binary patch delta 20 acmew*_DhUApO=@50SK;b3*N|`&kX=T+Xd7B delta 20 acmew*_DhUApO=@50SGbzO*V4pa{~Z6-~{3T diff --git a/src/back/about_inspection/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/about_inspection/migrations/__pycache__/__init__.cpython-310.pyc index 931a65e3ace53e717c8bfc52f8fda42c40f03b5d..728be776944f957bdf75bc3d514c055b3940b9ac 100644 GIT binary patch delta 19 ZcmeBT>|*53=jG*M0D^1Vf+up<0{|#31g`)9 delta 19 YcmeBT>|*53=jG*M0D_D_lZo8*03##=y#N3J diff --git a/src/back/accounts/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/accounts/migrations/__pycache__/0001_initial.cpython-310.pyc index bba215063d0d75574a0d12fa20c28ff5c54c08c2..881179603bc7a3ef84a1c9ae89135c1157743997 100644 GIT binary patch delta 20 acmcc3f195>pO=@50SK;b3*N|mfgJ!m0|n&( delta 20 acmcc3f195>pO=@50SGbzO*V30UkyHwH%l delta 20 acmew={#BeipO=@50SGbzO*V4B;syXaJOxz% diff --git a/src/back/calendar_of_events/migrations/__pycache__/0002_alter_calendar_author.cpython-310.pyc b/src/back/calendar_of_events/migrations/__pycache__/0002_alter_calendar_author.cpython-310.pyc index d2484b4f2aff51b37f93b5e273989b887d00411e..de376c07d886f2de06e5e87c8f34526377129ac5 100644 GIT binary patch delta 20 acmeBW>t*B4=jG*M0D^1Vf;VzAF#`ZCiv(o= delta 20 ZcmeBW>t*B4=jG*M0D_D_la1U=%m62l19JcX diff --git a/src/back/calendar_of_events/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/calendar_of_events/migrations/__pycache__/__init__.cpython-310.pyc index f658a53761aca99f37a6ff66564d8c33a3c1ad3b..6eb83438aafbc3e6a6abd3e635c0d95a0e40d28a 100644 GIT binary patch delta 19 ZcmeBS>|x~2=jG*M0D^1Vf+un}0sts?1hoJF delta 19 YcmeBS>|x~2=jG*M0D_D_lZo7o03&V#!vFvP diff --git a/src/back/commeteresp/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/commeteresp/migrations/__pycache__/0001_initial.cpython-310.pyc index 92bd549fc862efdc9d52499b41205554429b6b37..366c69d219bf754d0da9dba68c40c590ee987a34 100644 GIT binary patch delta 20 acmdn1x>uDupO=@50SK;b3*N}RNeBQsb_K!! delta 20 acmdn1x>uDupO=@50SGbzO*V3G5&{4;dj!w` diff --git a/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc index 40c69348ba3bb8786763f103fb22da823e55a488..2891d9815e98141621d35813b65ef1a6f2b1d4bb 100644 GIT binary patch delta 19 ZcmZo=Y-Qxm=jG*M0D^1Vf+uoU0RSg-1fT!_ delta 19 YcmZo=Y-Qxm=jG*M0D_D_lZo6_03vGxt^fc4 diff --git a/src/back/general_vacation/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/general_vacation/migrations/__pycache__/0001_initial.cpython-310.pyc index e9e47c43a553de3acb8d30e2ed6996a501d7399f..ae80862f87af8a717a135eeb3e4df9daa6272904 100644 GIT binary patch delta 20 acmX>pa8iIfpO=@50SK;b3*N|W#{mF1SOqcw delta 20 acmX>pa8iIfpO=@50SGbzO*V4daR2}^T?9Y? diff --git a/src/back/general_vacation/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/general_vacation/migrations/__pycache__/__init__.cpython-310.pyc index a337c044419eea01021b02e4df10cbc4f522d244..74fe081050e59d35ecefc7deb90298a7ec26b4ef 100644 GIT binary patch delta 19 ZcmeBT>|*53=jG*M0D^1Vf+up<0{|#31g`)9 delta 19 YcmeBT>|*53=jG*M0D_D_lZo8*03##=y#N3J diff --git a/src/back/navigation/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/0001_initial.cpython-310.pyc index f7a1baacbbe2a1b0d36b2457c6698f645571d31f..ad32a6e647c2a9120817728c3cc58280498b84ea 100644 GIT binary patch delta 20 acmeyT{!g7dpO=@50SK;b3*N~6Sr`CB=LU)Z delta 20 acmeyT{!g7dpO=@50SGbzO*V3W76t%5>;;$r diff --git a/src/back/navigation/migrations/__pycache__/0002_news_vote.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/0002_news_vote.cpython-310.pyc index c62e1c61ca530b68b05cd94cedfea28cbffacb5a..b1472238e4009af268a61e47766624fc3ec601ab 100644 GIT binary patch delta 20 acmaFO{F<3NpO=@50SK;b3*N~6fDr&Z%?0-W delta 20 acmaFO{F<3NpO=@50SGbzO*V2rU<3d*(gg(o diff --git a/src/back/navigation/migrations/__pycache__/0003_news_vote.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/0003_news_vote.cpython-310.pyc index 76087c2adfb3d6be669fd3aa8e8cc19fe9152483..3219123dea73e2a2709a1594cb665094b02f3c12 100644 GIT binary patch delta 91 zcmdnMx`CBDpO=@50SK;b3!cdRi}BWEHpWM6(m;VC>B;XHd(6Z@OcpR7m5>2)Z*kb< X=BJeAq}nk8dBto%LV$^bQH&V?%*YZL delta 91 zcmdnMx`CBDpO=@50SGbzO(t^xVvL&1#`uU$3Mfz{HTfN5kC`Zl$pYr164F5KEe@O9 X{FKt1R69l>ub2%;2rzLliZKHKUg{8^ diff --git a/src/back/navigation/migrations/__pycache__/0004_remove_news_vote.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/0004_remove_news_vote.cpython-310.pyc index bda4c67470e1574057c77551e285e3624371b07a..4c13fb64ef1b7fc96c8e0414fcfea28f6e9299aa 100644 GIT binary patch delta 56 zcmaFO{F<3NpO=@50SK;b3!ccml`(4K!B#eYAis!zvJYda0E7wVg9w4i7a64hn*|K& delta 56 zcmaFO{F<3NpO=@50SGbzO(t@0WxO@4Le diff --git a/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc index b0d554faee10621e44ca5c9769770d08e2605d05..7f1631bc648ea0674867ddc70d7c5827601dd490 100644 GIT binary patch delta 19 ZcmZo+Y+>Zi=jG*M0D^1Vf+uoU0stpZ1f2i? delta 19 YcmZo+Y+>Zi=jG*M0D_D_lZo7w03t>Ms{jB1 diff --git a/src/back/safety/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/safety/migrations/__pycache__/0001_initial.cpython-310.pyc index 4276e11bd3c50b92ead1753144bffc912d623ab6..87f31ff1a1581ab67b628c4892a2de9c54bd8b69 100644 GIT binary patch delta 20 acmaFB_kfQ(pO=@50SK;b3*N{b$_@ZKrv-8V delta 20 acmaFB_kfQ(pO=@50SGbzO*V3evI77$tOS4n diff --git a/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc index 0d5e37633c7864dbd1080f57f3a93f0c3b59d0d4..603d89ed9aa95026a40b418363eca57732e91028 100644 GIT binary patch delta 19 ZcmZo*Y+&Th=jG*M0D^1Vf+up90stnv1d#v$ delta 19 YcmZo*Y+&Th=jG*M0D_D_lZo7=03osip8x;= diff --git a/src/back/tests/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0001_initial.cpython-310.pyc index 905624bc41b277cd538c8c472f827742e7ba9dcb..0a64f35423aedeed6547c95b4b45a836aa707e9d 100644 GIT binary patch delta 20 acmX>jb4G?cpO=@50SK;b3*N}>$OiyAh6Pyw delta 20 acmX>jb4G?cpO=@50SIP3Fx$xO$Oiy9Mg=JV diff --git a/src/back/tests/migrations/__pycache__/0002_test_dateend_test_datestart.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0002_test_dateend_test_datestart.cpython-310.pyc index d6ea40029a6205c901f55a70de6c91056f3381ec..30ece33143c691d5f779e411a498931d6b375689 100644 GIT binary patch delta 20 acmX@fe3F?vpO=@50SK;b3*N}Rj}ZVjeFc#K delta 20 acmX@fe3F?vpO=@50SLT!%r|oHV*~&%Ap}1F diff --git a/src/back/tests/migrations/__pycache__/0003_testing_is_active.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0003_testing_is_active.cpython-310.pyc index 47edc650d712f27f0196446699184141cc2696e8..74ef8d5c64a81f8a959ffcf184cd977615a08e1b 100644 GIT binary patch delta 56 zcmeyt@`HstpO=@50SK;b3!cb*g7MbGD}UHTf&3!T$=4Vw1RzW>A4G^vj$@Jn0M-)@ AVgLXD delta 56 zcmeyt@`HstpO=@50SIoYTTJ9W!5B61${#inAiqdt@-@Z^0SFV!2N9x^ diff --git a/src/back/tests/migrations/__pycache__/0004_test_is_available.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0004_test_is_available.cpython-310.pyc index 97852214d6e58a865eef8a9fac2eee5f14e1bd5f..fbfc017788f41a6516536c49a4f6f712771378f3 100644 GIT binary patch delta 20 acmaFB@_>aqpO=@50SK;b3*N{b$^-y9It5t( delta 20 acmaFB@_>aqpO=@50SJy-T5jYHWdZ;;Qv|U9 diff --git a/src/back/tests/migrations/__pycache__/0005_testing_datestart_testing_news.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0005_testing_datestart_testing_news.cpython-310.pyc index 49da51ae8bb9788fb992932481ae7ed770764382..bfca8d81f413f00d195a83fececc7fe24d63d8b5 100644 GIT binary patch delta 20 acmdnTzK@+dpO=@50SK;b3*N}RnHc~!R|R?i delta 20 acmdnTzK@+dpO=@50SFHG+HU0D%nSfB*#zYP diff --git a/src/back/tests/migrations/__pycache__/0006_testresult_question_alter_testresult_answer.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0006_testresult_question_alter_testresult_answer.cpython-310.pyc index 44a4ecacf539a5868bb6b824c9e6827f71d201fa..f8683e388d55b104edc30b87b6e717b674b30669 100644 GIT binary patch delta 79 zcmX@Xc7lyNpO=@50SK;b3!cdRpYhgYZpNkDoIrshkZ=+AO2T-7h6GU)L-px3PO&Y|Mo*c}yicxg( TKPEW=hyYj=M956mVU_^^)l3kh diff --git a/src/back/tests/migrations/__pycache__/0007_alter_testattempt_testing_alter_testing_user.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0007_alter_testattempt_testing_alter_testing_user.cpython-310.pyc index 700f2b8f2ba967aacf3718fb839490439ed548f2..36ce42c22bd4f286b8af9e0e739df00ef6e75c70 100644 GIT binary patch delta 20 acmZ3-zK)$cpO=@50SK;b3*N}Rm>B>w*9A%d delta 20 acmZ3-zK)$cpO=@50SMUM+i&Dv%nSf883dmI diff --git a/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc index 09936bb62d523ad61337fa035b21a57d50eff86b..0799869911416f7ef683a314da95f8118f7672b1 100644 GIT binary patch delta 17 Xcmb=g=g#NlrUT^w diff --git a/src/back/vote/migrations/__pycache__/0003_vote_news.cpython-310.pyc b/src/back/vote/migrations/__pycache__/0003_vote_news.cpython-310.pyc index 099f17f0ba4e5ee88c3627b3daf5349031344615..29aa10adabe49adbab108d3667cbf966cf18bd2a 100644 GIT binary patch delta 20 acmcb`dW)4ipO=@50SK;b3*N|mo(TXtZUxBz delta 20 acmcb`dW)4ipO=@50SGbzO*V3$X955;a|G7_ diff --git a/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc index 6d79e4dc46218794a747ffc700b71c81d6226c16..8e6d02942ac1f9f7967a4eb5e042bfe4d9eae5fc 100644 GIT binary patch delta 17 Xcmb=c Date: Thu, 19 Jun 2025 11:11:10 +0300 Subject: [PATCH 14/14] admin vote, tests --- src/back/tests/admin.py | 2 + src/back/vote/admin.py | 22 +++++++++-- ..._answer_file_alter_answer_name_and_more.py | 37 +++++++++++++++++++ src/back/vote/models.py | 8 ++-- 4 files changed, 62 insertions(+), 7 deletions(-) create mode 100644 src/back/vote/migrations/0004_alter_answer_file_alter_answer_name_and_more.py diff --git a/src/back/tests/admin.py b/src/back/tests/admin.py index dc0563d7c..c2926eca7 100644 --- a/src/back/tests/admin.py +++ b/src/back/tests/admin.py @@ -5,11 +5,13 @@ import nested_admin class TestAnswerInline(nested_admin.NestedStackedInline): model = TestAnswer extra = 0 + fields = ('name', 'file', 'right_wrong') class TestQuestionInline(nested_admin.NestedStackedInline): model = TestQuestion extra = 0 inlines = [TestAnswerInline] + fields = ('name', 'file') class TestAdmin(nested_admin.NestedModelAdmin): inlines = [TestQuestionInline] diff --git a/src/back/vote/admin.py b/src/back/vote/admin.py index 19a39c4cc..6398499e8 100644 --- a/src/back/vote/admin.py +++ b/src/back/vote/admin.py @@ -1,6 +1,22 @@ from django.contrib import admin from .models import * +import nested_admin -admin.site.register(Vote) -admin.site.register(Question) -admin.site.register(Answer) \ No newline at end of file +# admin.site.register(Vote) +# admin.site.register(Question) +# admin.site.register(Answer) + +class AnswerInline(nested_admin.NestedTabularInline): + model = Answer + extra = 1 + fields = ('name', 'file') + +class QuestionInline(nested_admin.NestedStackedInline): + model = Question + inlines = [AnswerInline] + extra = 1 + fields = ('name', 'file') + +@admin.register(Vote) +class VoteAdmin(nested_admin.NestedModelAdmin): + inlines = [QuestionInline] \ No newline at end of file diff --git a/src/back/vote/migrations/0004_alter_answer_file_alter_answer_name_and_more.py b/src/back/vote/migrations/0004_alter_answer_file_alter_answer_name_and_more.py new file mode 100644 index 000000000..c5128c6b6 --- /dev/null +++ b/src/back/vote/migrations/0004_alter_answer_file_alter_answer_name_and_more.py @@ -0,0 +1,37 @@ +# Generated by Django 5.1.6 on 2025-06-19 08:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("vote", "0003_vote_news"), + ] + + operations = [ + migrations.AlterField( + model_name="answer", + name="file", + field=models.FileField( + blank=True, null=True, upload_to="vote/answer_files/", verbose_name="Картинка" + ), + ), + migrations.AlterField( + model_name="answer", + name="name", + field=models.CharField(max_length=255, verbose_name="Ответ"), + ), + migrations.AlterField( + model_name="question", + name="file", + field=models.ImageField( + blank=True, null=True, upload_to="vote/question_images/", verbose_name="Картинка" + ), + ), + migrations.AlterField( + model_name="question", + name="name", + field=models.CharField(max_length=255, verbose_name="Вопрос"), + ), + ] diff --git a/src/back/vote/models.py b/src/back/vote/models.py index 08ff0a896..946affab2 100644 --- a/src/back/vote/models.py +++ b/src/back/vote/models.py @@ -26,9 +26,9 @@ class Vote(models.Model): verbose_name_plural = "Голосования" class Question(models.Model): - name = models.CharField(max_length=255) + name = models.CharField(max_length=255, verbose_name="Вопрос") vote = models.ForeignKey(Vote, related_name='questions', on_delete=models.CASCADE) - file = models.ImageField(upload_to='vote/question_images/', null=True, blank=True) + file = models.ImageField(upload_to='vote/question_images/', null=True, blank=True,verbose_name='Картинка') numb = models.PositiveIntegerField() settings = models.JSONField(default=dict, verbose_name='Json настроек голосования') @@ -40,8 +40,8 @@ class Question(models.Model): verbose_name_plural = "Вопросы" class Answer(models.Model): - name = models.CharField(max_length=255) - file = models.FileField(upload_to='vote/answer_files/', null=True, blank=True) + name = models.CharField(max_length=255, verbose_name='Ответ') + file = models.FileField(upload_to='vote/answer_files/', null=True, blank=True,verbose_name='Картинка') question = models.ForeignKey(Question, related_name='answers', on_delete=models.CASCADE) def __str__(self):