diff --git a/.env.base b/.env.base index b4f5465aa..eb8f072e1 100644 --- a/.env.base +++ b/.env.base @@ -55,4 +55,4 @@ NGINX_EXTERNAL_PORT=80 NGINX_INTERNAL_PORT=80 RUN_WITH_DOCS=False -PRODUCTION=False +PRODUCTION=True diff --git a/easydockersave b/easydockersave index b72d231e8..0bf5ed16e 120000 --- a/easydockersave +++ b/easydockersave @@ -1 +1 @@ -/home/nukeap/projects/PORTAL_COD2/sys/scripts/easydockersave.sh \ No newline at end of file +/home/denzel/Документы/PORTAL_COD2/sys/scripts/easydockersave.sh \ No newline at end of file diff --git a/easyserver b/easyserver index dd68800b6..24a03aacc 120000 --- a/easyserver +++ b/easyserver @@ -1 +1 @@ -/home/nukeap/projects/PORTAL_COD2/sys/scripts/easyserver.sh \ No newline at end of file +/home/denzel/Документы/PORTAL_COD2/sys/scripts/easyserver.sh \ No newline at end of file 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 5cede0f26..e911c828e 100644 Binary files a/src/back/about_inspection/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/about_inspection/migrations/__pycache__/0001_initial.cpython-310.pyc differ 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 cb371f7b8..728be7769 100644 Binary files a/src/back/about_inspection/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/about_inspection/migrations/__pycache__/__init__.cpython-310.pyc differ 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 5cdb51cbe..881179603 100644 Binary files a/src/back/accounts/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/accounts/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/src/back/accounts/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/accounts/migrations/__pycache__/__init__.cpython-310.pyc index e889456ed..1937b86c3 100644 Binary files a/src/back/accounts/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/accounts/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/back/calendar_of_events/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/calendar_of_events/migrations/__pycache__/0001_initial.cpython-310.pyc index 68b50fecf..954af8bf7 100644 Binary files a/src/back/calendar_of_events/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/calendar_of_events/migrations/__pycache__/0001_initial.cpython-310.pyc differ 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 156dcb424..de376c07d 100644 Binary files a/src/back/calendar_of_events/migrations/__pycache__/0002_alter_calendar_author.cpython-310.pyc and b/src/back/calendar_of_events/migrations/__pycache__/0002_alter_calendar_author.cpython-310.pyc differ 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 e2b8d6f7d..6eb83438a 100644 Binary files a/src/back/calendar_of_events/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/calendar_of_events/migrations/__pycache__/__init__.cpython-310.pyc differ 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 ad1958f7d..366c69d21 100644 Binary files a/src/back/commeteresp/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/commeteresp/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc index 56858ac04..2891d9815 100644 Binary files a/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/commeteresp/migrations/__pycache__/__init__.cpython-310.pyc differ 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 8e1e7eed7..ae80862f8 100644 Binary files a/src/back/general_vacation/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/general_vacation/migrations/__pycache__/0001_initial.cpython-310.pyc differ 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 45cc44c6c..74fe08105 100644 Binary files a/src/back/general_vacation/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/general_vacation/migrations/__pycache__/__init__.cpython-310.pyc differ 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 66bb53c2d..ad32a6e64 100644 Binary files a/src/back/navigation/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/navigation/migrations/__pycache__/0001_initial.cpython-310.pyc differ 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 7dd73c689..b1472238e 100644 Binary files a/src/back/navigation/migrations/__pycache__/0002_news_vote.cpython-310.pyc and b/src/back/navigation/migrations/__pycache__/0002_news_vote.cpython-310.pyc differ 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 5a5f8977c..3219123de 100644 Binary files a/src/back/navigation/migrations/__pycache__/0003_news_vote.cpython-310.pyc and b/src/back/navigation/migrations/__pycache__/0003_news_vote.cpython-310.pyc differ 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 9cf7ab124..4c13fb64e 100644 Binary files a/src/back/navigation/migrations/__pycache__/0004_remove_news_vote.cpython-310.pyc and b/src/back/navigation/migrations/__pycache__/0004_remove_news_vote.cpython-310.pyc differ diff --git a/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc index af390d965..7f1631bc6 100644 Binary files a/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/navigation/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/back/portal/ds.py b/src/back/portal/ds.py index 3d40b8d2d..74e6e4adf 100644 --- a/src/back/portal/ds.py +++ b/src/back/portal/ds.py @@ -21,9 +21,9 @@ class Settings: self.db = { "default": { "ENGINE": "django.db.backends.mysql", - "NAME": os.getenv("DB_NAME"), # Имя базы данных + "NAME": "portal_test", # Имя базы данных "USER": os.getenv("DB_USER"), # Имя пользователя - "PASSWORD": os.getenv("DB_PASSWORD"), # Пароль + "PASSWORD": "P@sw0rd", # Пароль "HOST": os.getenv("DB_HOST"), # Хост "PORT": os.getenv("DB_INTERNAL_PORT"), # Порт } 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 6df7bf8cf..87f31ff1a 100644 Binary files a/src/back/safety/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/safety/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc index 99d48a974..603d89ed9 100644 Binary files a/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/safety/migrations/__pycache__/__init__.cpython-310.pyc differ 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/tests/migrations/0008_alter_test_pass_perc_alter_testanswer_right_wrong.py b/src/back/tests/migrations/0008_alter_test_pass_perc_alter_testanswer_right_wrong.py new file mode 100644 index 000000000..5f8b84404 --- /dev/null +++ b/src/back/tests/migrations/0008_alter_test_pass_perc_alter_testanswer_right_wrong.py @@ -0,0 +1,23 @@ +# Generated by Django 5.1.6 on 2025-06-24 08:23 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("tests", "0007_alter_testattempt_testing_alter_testing_user"), + ] + + operations = [ + migrations.AlterField( + model_name="test", + name="pass_perc", + field=models.FloatField(verbose_name="Мин. % правильных ответов"), + ), + migrations.AlterField( + model_name="testanswer", + name="right_wrong", + field=models.BooleanField(verbose_name="Правильно"), + ), + ] 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 63832c29f..0a64f3542 100644 Binary files a/src/back/tests/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0001_initial.cpython-310.pyc differ 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 1007c5602..30ece3314 100644 Binary files a/src/back/tests/migrations/__pycache__/0002_test_dateend_test_datestart.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0002_test_dateend_test_datestart.cpython-310.pyc differ 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 f9eea5d27..74ef8d5c6 100644 Binary files a/src/back/tests/migrations/__pycache__/0003_testing_is_active.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0003_testing_is_active.cpython-310.pyc differ 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 1bbf199c9..fbfc01778 100644 Binary files a/src/back/tests/migrations/__pycache__/0004_test_is_available.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0004_test_is_available.cpython-310.pyc differ 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 49921c085..bfca8d81f 100644 Binary files a/src/back/tests/migrations/__pycache__/0005_testing_datestart_testing_news.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0005_testing_datestart_testing_news.cpython-310.pyc differ 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 b48889c3e..f8683e388 100644 Binary files a/src/back/tests/migrations/__pycache__/0006_testresult_question_alter_testresult_answer.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0006_testresult_question_alter_testresult_answer.cpython-310.pyc differ 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 ce13c308f..36ce42c22 100644 Binary files a/src/back/tests/migrations/__pycache__/0007_alter_testattempt_testing_alter_testing_user.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/0007_alter_testattempt_testing_alter_testing_user.cpython-310.pyc differ diff --git a/src/back/tests/migrations/__pycache__/0008_alter_test_pass_perc_alter_testanswer_right_wrong.cpython-310.pyc b/src/back/tests/migrations/__pycache__/0008_alter_test_pass_perc_alter_testanswer_right_wrong.cpython-310.pyc new file mode 100644 index 000000000..9cb7c3f3e Binary files /dev/null and b/src/back/tests/migrations/__pycache__/0008_alter_test_pass_perc_alter_testanswer_right_wrong.cpython-310.pyc differ diff --git a/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc index 721ee85aa..079986991 100644 Binary files a/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/tests/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/src/back/tests/models.py b/src/back/tests/models.py index 4acfa3bfa..3b2769217 100644 --- a/src/back/tests/models.py +++ b/src/back/tests/models.py @@ -16,7 +16,7 @@ class Test(models.Model): description = models.TextField(verbose_name='Описание') author = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='Создатель тестирования') - pass_perc = models.FloatField(blank=False, verbose_name="Мин. кол-во правильных ответов") + pass_perc = models.FloatField(blank=False, verbose_name="Мин. % правильных ответов") time = models.FloatField(blank=False, verbose_name="Время прохождения теста") question_count = models.PositiveIntegerField(blank=False, verbose_name="Количество вопросов") attemps_number = models.PositiveIntegerField(blank=False, verbose_name="Количество попыток") @@ -60,7 +60,7 @@ class TestAnswer(models.Model): related_name='answers', on_delete=models.CASCADE, verbose_name="Вопрос") - right_wrong = models.BooleanField(blank=False, verbose_name="Правильно/Неправильно") + right_wrong = models.BooleanField(blank=False, verbose_name="Правильно") class Meta: verbose_name = "Ответ" diff --git a/src/back/tests/views.py b/src/back/tests/views.py index e996c8b99..a0a94d9f8 100644 --- a/src/back/tests/views.py +++ b/src/back/tests/views.py @@ -517,6 +517,10 @@ class TestResultView(generics.ListCreateAPIView): test_answers = TestAnswer.objects.filter(id__in=answer_ids) test = Test.objects.get(id=test_id) answered_questions_total = test_answers.values('question').distinct().count() + q_count = test.question_count + all_questions = len(TestQuestion.objects.filter(test=test)) + if all_questions <= q_count: + q_count = all_questions correct_questions = sum( TestAnswer.objects.filter( @@ -531,8 +535,10 @@ class TestResultView(generics.ListCreateAPIView): pass_perc = test.pass_perc correct_answers_perc = 0 - if answered_questions_total !=0: - correct_answers_perc = correct_questions/answered_questions_total*100 + if q_count !=0: + correct_answers_perc = correct_questions/q_count*100 + # if answered_questions_total !=0: + # correct_answers_perc = correct_questions/answered_questions_total*100 result = { "is_passed": correct_answers_perc >= pass_perc, "score": correct_questions, diff --git a/src/back/userauth/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/userauth/migrations/__pycache__/0001_initial.cpython-310.pyc index 1c0bd9757..de5cc29ac 100644 Binary files a/src/back/userauth/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/userauth/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/src/back/userauth/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/userauth/migrations/__pycache__/__init__.cpython-310.pyc index 96a84006d..8ae244756 100644 Binary files a/src/back/userauth/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/userauth/migrations/__pycache__/__init__.cpython-310.pyc differ 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/migrations/__pycache__/0001_initial.cpython-310.pyc b/src/back/vote/migrations/__pycache__/0001_initial.cpython-310.pyc index c0ba47836..0cfbd6ae3 100644 Binary files a/src/back/vote/migrations/__pycache__/0001_initial.cpython-310.pyc and b/src/back/vote/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/src/back/vote/migrations/__pycache__/0002_initial.cpython-310.pyc b/src/back/vote/migrations/__pycache__/0002_initial.cpython-310.pyc index 47161d201..11a32e9d3 100644 Binary files a/src/back/vote/migrations/__pycache__/0002_initial.cpython-310.pyc and b/src/back/vote/migrations/__pycache__/0002_initial.cpython-310.pyc differ 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 18e309ad6..29aa10ada 100644 Binary files a/src/back/vote/migrations/__pycache__/0003_vote_news.cpython-310.pyc and b/src/back/vote/migrations/__pycache__/0003_vote_news.cpython-310.pyc differ diff --git a/src/back/vote/migrations/__pycache__/0004_alter_answer_file_alter_answer_name_and_more.cpython-310.pyc b/src/back/vote/migrations/__pycache__/0004_alter_answer_file_alter_answer_name_and_more.cpython-310.pyc new file mode 100644 index 000000000..a5093ad94 Binary files /dev/null and b/src/back/vote/migrations/__pycache__/0004_alter_answer_file_alter_answer_name_and_more.cpython-310.pyc differ diff --git a/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc b/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc index e6738ebc3..8e6d02942 100644 Binary files a/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc and b/src/back/vote/migrations/__pycache__/__init__.cpython-310.pyc differ 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): 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 @@ + + + + Нет доступных данных + + + {{ item.raw.familyname }} diff --git a/src/front/src/components/UI/fiousercard/listUser.vue b/src/front/src/components/UI/fiousercard/listUser.vue index aad468665..270f416fc 100644 --- a/src/front/src/components/UI/fiousercard/listUser.vue +++ b/src/front/src/components/UI/fiousercard/listUser.vue @@ -4,10 +4,11 @@ v-if="from_which == 'dialog-search'" class="pl-4 h-100 text-left pa-2" @click="open = true" + active-color="teal-darken-4" > @@ -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 f6b966916..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" > @@ -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..a623477a4 100644 --- a/src/front/src/components/digital-letna.vue +++ b/src/front/src/components/digital-letna.vue @@ -28,7 +28,7 @@ @@ -234,4 +234,14 @@ export default { .fiction .v-input__control { display: none; } + + + \ No newline at end of file diff --git a/src/front/src/components/news-full.vue b/src/front/src/components/news-full.vue index d761338b9..3eb034173 100644 --- a/src/front/src/components/news-full.vue +++ b/src/front/src/components/news-full.vue @@ -282,7 +282,7 @@ variant="text" size="small" icon="mdi-delete" - color="delete_btn" + color="teal-darken-4" @click="deletComment(y.id, newsFull.id)" /> @@ -353,6 +353,7 @@ density="compact" variant="text" icon="mdi-close" + color="teal-darken-4" @click="dialogfoto = false" /> @@ -364,6 +365,7 @@ density="compact" variant="text" icon="mdi-chevron-left" + color="teal-darken-4" @click=" indximg != 0 ? (indximg -= 1) @@ -382,6 +384,7 @@ density="compact" variant="text" icon="mdi-chevron-right" + color="teal-darken-4" @click=" indximg != newsFull.gallery.length - 1 ? (indximg += 1) @@ -422,6 +425,7 @@ density="compact" variant="text" icon="mdi-close" + color="teal-darken-4" @click="dialogfotoOne = false" /> diff --git a/src/front/src/components/news-home.vue b/src/front/src/components/news-home.vue index 73b588d92..28beebca8 100644 --- a/src/front/src/components/news-home.vue +++ b/src/front/src/components/news-home.vue @@ -56,7 +56,7 @@ size="small" variant="text" icon="mdi-newspaper" - color="blue-darken-4" + color="teal-darken-4" :to='`/news`' /> diff --git a/src/front/src/components/testing/AssignTestDialog.vue b/src/front/src/components/testing/AssignTestDialog.vue index 3795b6264..933e3159d 100644 --- a/src/front/src/components/testing/AssignTestDialog.vue +++ b/src/front/src/components/testing/AssignTestDialog.vue @@ -208,7 +208,7 @@ export default { // Устанавливаем начальные даты const currentDate = new Date(); const defaultStartDate = new Date(currentDate); - defaultStartDate.setHours(9, 0, 0, 0); + defaultStartDate.setHours(8, 0, 0, 0); const defaultEndDate = new Date(currentDate); defaultEndDate.setHours(18, 0, 0, 0); diff --git a/src/front/src/components/testing/BodyDetailTesting.vue b/src/front/src/components/testing/BodyDetailTesting.vue index 74e3e7149..fc302986b 100644 --- a/src/front/src/components/testing/BodyDetailTesting.vue +++ b/src/front/src/components/testing/BodyDetailTesting.vue @@ -1,45 +1,70 @@ - - + + - Информация - + Информация + - - - + + - + - Время на прохождение: {{ formatTime.value }} {{ formatTime.unit }} + Время на прохождение: {{ formatTime.value }} + {{ formatTime.unit }} + + + + + + + Количество вопросов: + {{ data?.question_count }} - - - - Количество вопросов: {{ data?.question_count }} - - - - + Количество попыток: {{ remainingAttempts !== undefined ? remainingAttempts : data?.attemps_number }} - + @@ -50,12 +75,12 @@ - {{ isExamMode ? 'Начать' : 'Тренироваться' }} + {{ isExamMode ? "Начать" : "Тренироваться" }} diff --git a/src/front/src/components/testing/CatalogTest.vue b/src/front/src/components/testing/CatalogTest.vue index 1ed17fb9c..187769b25 100644 --- a/src/front/src/components/testing/CatalogTest.vue +++ b/src/front/src/components/testing/CatalogTest.vue @@ -1,6 +1,7 @@ + - - - Попытки закончились + + + + Попытки закончились + + + Для повторного прохожденияобратитесь к администратору + @@ -80,6 +86,7 @@ + @@ -208,6 +222,15 @@ export default { background: rgba(244, 67, 54, 0.1); } +.no-attempts-container { + display: flex; + flex-direction: column; + align-items: center; + padding: 12px; + max-width: 200px; + text-align: center; +} + .empty-state { min-height: 300px; display: flex; diff --git a/src/front/src/components/testing/DetailCardTest.vue b/src/front/src/components/testing/DetailCardTest.vue index 5211aab7c..3b9330586 100644 --- a/src/front/src/components/testing/DetailCardTest.vue +++ b/src/front/src/components/testing/DetailCardTest.vue @@ -23,6 +23,7 @@ :answers="answers" :finishTest="openFinishDialog" @change-question="changeQuestion" + @answer-changed="onAnswerChanged" /> @@ -36,6 +37,7 @@ :formattedTime="formatSpentTime" :questions="data?.questions" :userAnswers="answers" + :remainingAttempts="remainingAttempts" @restart="startTest" /> @@ -147,16 +149,20 @@ export default { const startTest = async () => { 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; // Прерываем запуск теста если попыток не осталось + return; } testStarted.value = true; testFinished.value = false; + currentQuestion.value = 0; - answers.value = Array(data.value.questions.length).fill(null); + answers.value = data.value.questions.map((question) => { + const correctAnswersCount = question.answers.filter(answer => answer.right_wrong).length; + return correctAnswersCount > 1 ? [] : null; + }); const initialTime = data.value.time * 60; data.value = { ...data.value, time: initialTime }; @@ -168,7 +174,7 @@ export default { timer = setInterval(() => { if (data.value?.time > 0) { - data.value = { ...data.value, time: data.value.time - 1 }; + data.value.time = data.value.time - 1; spentTime.value += 1; } else { finishTest(); @@ -183,7 +189,6 @@ export default { showFinishDialog.value = false; try { - // [{ question_id, answers_id: [id, ...] }] let answersToSubmit = []; data.value.questions.forEach((question, questionIndex) => { const answer = answers.value[questionIndex]; @@ -226,11 +231,20 @@ export default { const answers = ref([]); - watch(data.value?.questions, (newData) => { - if (newData && Array.isArray(newData.questions)) { - answers.value = newData.questions.map(() => null); - } - }); + watch( + () => data.value?.questions, + (newQuestions) => { + if (newQuestions && Array.isArray(newQuestions)) { + if (!answers.value || answers.value.length === 0) { + answers.value = newQuestions.map((question) => { + const correctAnswersCount = question.answers.filter(answer => answer.right_wrong).length; + return correctAnswersCount > 1 ? [] : null; + }); + } + } + }, + { deep: true } + ); const correctAnswers = computed( () => @@ -255,7 +269,11 @@ export default { ); const answeredQuestions = computed( - () => answers.value.filter((answer) => answer !== null).length, + () => answers.value.filter((answer) => { + if (answer === null || answer === undefined) return false; + if (Array.isArray(answer)) return answer.length > 0; + return true; + }).length, ); const testPassed = computed(() => testResults.value?.is_passed ?? false); @@ -266,6 +284,13 @@ export default { } }; + const onAnswerChanged = (questionIndex, value) => { + + const newAnswers = [...answers.value]; + newAnswers[questionIndex] = value; + answers.value = newAnswers; + }; + const openFinishDialog = () => { showFinishDialog.value = true; }; @@ -288,6 +313,7 @@ export default { answers, currentQuestion, changeQuestion, + onAnswerChanged, showFinishDialog, openFinishDialog, correctAnswers, diff --git a/src/front/src/components/testing/HeaderDetailTesting.vue b/src/front/src/components/testing/HeaderDetailTesting.vue index 469816097..f492cce4f 100644 --- a/src/front/src/components/testing/HeaderDetailTesting.vue +++ b/src/front/src/components/testing/HeaderDetailTesting.vue @@ -52,7 +52,7 @@ - + - + @@ -166,11 +169,6 @@ export default { color: rgb(var(--v-theme-text_carous)); } -.v-radio-group :deep(.v-radio:hover), -.v-checkbox:hover { - transform: translateX(4px); -} - .v-btn { text-transform: none; font-weight: 500; diff --git a/src/front/src/components/testing/TestResults.vue b/src/front/src/components/testing/TestResults.vue index 08913c384..7f2fc9cb6 100644 --- a/src/front/src/components/testing/TestResults.vue +++ b/src/front/src/components/testing/TestResults.vue @@ -12,28 +12,11 @@ mdi-close-circle - Не пройдено + Тест не пройден - - - - mdi-checkbox-marked-circle - - {{ correctAnswers }}/{{ totalQuestions }} - - {{ isPracticeMode ? 'Правильных ответов (нажмите чтобы увидеть детали)' : 'Правильных ответов' }} - - - @@ -43,6 +26,24 @@ + + + + mdi-checkbox-marked-circle + + {{ correctAnswers }}/{{ totalQuestions }} + + {{ !fromCompletedTab ? 'Правильных ответов (нажмите чтобы увидеть детали)' : 'Правильных ответов' }} + + + + mdi-clock-outline @@ -52,11 +53,11 @@ - - + + - Правильные ответы + {{ isPracticeMode ? 'Правильные ответы' : 'Результаты по вопросам' }} @@ -78,33 +79,46 @@ - {{ question.name }} - - - - {{ getAnswerIcon(index, answer) }} - - - {{ answer.name }} - - - Ваш ответ - - - + {{ question.name }} + + + - - {{ isQuestionCorrect(index) ? 'Правильно ✓' : 'Неправильно ✗' }} + + + {{ getAnswerIcon(index, answer) }} + + + {{ answer.name }} + + + Ваш ответ + + + + + + + + + + {{ isQuestionCorrect(index) ? 'mdi-check-circle' : 'mdi-close-circle' }} + + {{ isQuestionCorrect(index) ? 'Правильно' : 'Неправильно' }} @@ -114,9 +128,10 @@ - - + + mdi-refresh Попробовать ещё раз + + + {{ getRetryMessage }} + @@ -157,6 +182,10 @@ export default { fromCompletedTab: { type: Boolean, default: false + }, + remainingAttempts: { + type: Number, + default: undefined } }, setup(props) { @@ -164,6 +193,29 @@ export default { const showAnswersDialog = ref(false); const isPracticeMode = computed(() => !route.query.mode || route.query.mode === 'practice'); + const isExamMode = computed(() => route.query.mode === 'exam'); + + const canRetry = computed(() => { + if (props.fromCompletedTab) return false; + if (isPracticeMode.value) return true; + if (isExamMode.value) { + // В режиме экзамена можно повторить только если есть попытки и тест не пройден + return props.remainingAttempts > 0 && !props.testPassed; + } + return true; + }); + + const getRetryMessage = computed(() => { + if (isExamMode.value && props.remainingAttempts !== undefined) { + if (props.testPassed) { + return 'Тест успешно пройден. Повторное прохождение недоступно.'; + } + if (props.remainingAttempts <= 0) { + return 'Нет оставшихся попыток для прохождения теста. Для повторного прохождения обратитесь к администратору.'; + } + } + return null; + }); const getQuestionStatusColor = (questionIndex) => { if (!props.questions[questionIndex]?.answers) return 'grey'; @@ -301,6 +353,9 @@ export default { return { showAnswersDialog, isPracticeMode, + isExamMode, + canRetry, + getRetryMessage, isQuestionCorrect, hasUserAnswer, showUserAnswer, diff --git a/src/front/src/components/vote/ConstructorVote/AnswerList.vue b/src/front/src/components/vote/ConstructorVote/AnswerList.vue index 7b80a8506..dd89380d1 100644 --- a/src/front/src/components/vote/ConstructorVote/AnswerList.vue +++ b/src/front/src/components/vote/ConstructorVote/AnswerList.vue @@ -36,6 +36,7 @@ label="Картинка" variant="outlined" :error-messages="answer.imageError" + class="file-input-fixed" @update:model-value="(file) => handleImageUpload(file, answer, aIndex)" > @@ -174,3 +175,11 @@ export default { } }; + + diff --git a/src/front/src/components/vote/ConstructorVote/MainInfo.vue b/src/front/src/components/vote/ConstructorVote/MainInfo.vue index 241a5c8d1..bb827a182 100644 --- a/src/front/src/components/vote/ConstructorVote/MainInfo.vue +++ b/src/front/src/components/vote/ConstructorVote/MainInfo.vue @@ -15,6 +15,7 @@ :rules="[rules.required]" label="Описание" variant="outlined" + class="scrollable-textarea" > @@ -183,5 +184,54 @@ export default { diff --git a/src/front/src/components/vote/ConstructorVote/QuestionItem.vue b/src/front/src/components/vote/ConstructorVote/QuestionItem.vue index aa91e35ba..d911358ac 100644 --- a/src/front/src/components/vote/ConstructorVote/QuestionItem.vue +++ b/src/front/src/components/vote/ConstructorVote/QuestionItem.vue @@ -45,7 +45,7 @@ > - Голосование по отделам: + Голосование: @@ -79,9 +82,11 @@ @update:model-value="toggleSelectAll" > - + {{ item.raw.familyname }} @@ -116,7 +121,8 @@ - + + {{ findEmployeeById(person.text)?.fio }} @@ -158,7 +166,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 +303,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 +359,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 +385,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 +414,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 203b47cc1..c93af7807 100644 --- a/src/front/src/components/vote/CurrentVote.vue +++ b/src/front/src/components/vote/CurrentVote.vue @@ -64,7 +64,7 @@ {{ answer.employee?.fio || answer.name }} - + @@ -197,6 +197,20 @@ export default { } }; + const toggleAnswer = (questionId, answerId) => { + const currentAnswers = result.value[questionId]; + const index = currentAnswers.indexOf(answerId); + + if (index === -1) { + const question = props.data.questions.find(q => q.id === questionId); + if (currentAnswers.length < question.settings.multiChoice) { + currentAnswers.push(answerId); + } + } else { + currentAnswers.splice(index, 1); + } + }; + const submitVote = () => { let voteData = [] for (let val of Object.values(result.value)) { @@ -220,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( @@ -263,6 +277,7 @@ export default { isCurrentQuestionAnswered, nextStep, prevStep, + toggleAnswer, submitVote, isVoteSubmitted, result diff --git a/src/front/src/components/vote/VoteConstructor.vue b/src/front/src/components/vote/VoteConstructor.vue index adcfd1bc7..12f4c08fd 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 }} + + + @@ -588,9 +593,9 @@ export default { }; watch( - form.value, - () => { - if (!form.value.title || !form.value.description || form.value.questions.length < 1) { + () => form.value, + (formValue) => { + if (!formValue.title || !formValue.description || formValue.questions.length < 1) { errorMessage.value = 'Все обязательные поля должны быть заполнены'; } else { errorMessage.value = ''; @@ -602,14 +607,13 @@ export default { watch( () => form.value.questions, (newQuestions) => { - quests.value = newQuestions.map((q) => !!q.text.trim()); const hasEmptyQuestions = newQuestions.some((q) => !q.text || q.text.trim() === ''); const hasInvalidAnswers = validateAnswers(); errorMessage.value = hasEmptyQuestions || hasInvalidAnswers - ? 'Все вопросы и ответы должны быть заполнены' + ? 'Все вопросы и ответы должны быть заполнены. Выбраны правильные ответы к вопросам.' : ''; }, { deep: true }, @@ -628,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)); @@ -686,11 +691,13 @@ export default { testImage, imagePreview, previewImage, + handleTestImageUpload, getImagePreviewUrl, actualQuestionCount, actualTestQuestionCount, isTest: props.isTest, - imageError + imageError, + validateImage }; }, }; 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 @@ - + - + - + @@ -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; +} diff --git a/src/front/src/views/TestHomePage.vue b/src/front/src/views/TestHomePage.vue index 3eeb7974f..92009920e 100644 --- a/src/front/src/views/TestHomePage.vue +++ b/src/front/src/views/TestHomePage.vue @@ -223,7 +223,8 @@ export default { pagecounter(); const accountStore = useAccountStore(); const router = useRouter(); - const activeTab = ref(0); + const savedTab = localStorage.getItem('testHomePage_activeTab'); + const activeTab = ref(savedTab ? parseInt(savedTab) : 0); const currentTest = ref(''); const getAllTests = ref([]); const deleteDialog = ref(false); @@ -239,13 +240,38 @@ export default { color: 'error' }); - // Функция для показа уведомлений const showNotification = (text, color = 'error') => { snackbar.value.text = text; snackbar.value.color = color; snackbar.value.show = true; }; + const updateCurrentTestCount = () => { + if (activeTab.value === 0) { + currentTest.value = getAllTests.value.filter(test => + test.is_active && + test.is_passed !== true && + test.attemps_number > 0 + ).length; + } + }; + + const getAssignedTestsCount = () => { + axiosApiInstance + .get('/api/tests/gettests?status=active') + .then((resp) => { + const assignedTests = resp.data.filter(test => + test.is_active && + test.is_passed !== true && + test.attemps_number > 0 + ); + currentTest.value = assignedTests.length; + }) + .catch(() => { + currentTest.value = 0; + }); + }; + const getTestById = () => { const status = activeTab.value === 2 ? '' : activeTab.value === 0 ? '?status=active' : @@ -258,26 +284,29 @@ export default { }) .finally(() => { if (activeTab.value === 0) { - currentTest.value = getAllTests.value.filter(test => - test.is_active && - test.is_passed !== true && - test.attemps_number > 0 - ).length; + updateCurrentTestCount(); + } else { + getAssignedTestsCount(); } }); }; getTestById(); + + if (activeTab.value !== 0) { + getAssignedTestsCount(); + } watch( () => activeTab.value, - () => { + (newTab) => { + localStorage.setItem('testHomePage_activeTab', newTab.toString()); getTestById(); }, ); const tabs = computed(() => [ - { value: 0, title: `Назначенные (${currentTest.value})` }, + { value: 0, title: `Назначенные${currentTest.value !== '' ? ` (${currentTest.value})` : ''}` }, { value: 1, title: 'Завершенные' }, { value: 2, title: 'Каталог' }, ...(accountStore.user.is_staff ? [{ value: 3, title: 'Создать новый тест' }] : []), @@ -363,7 +392,6 @@ export default { const assignmentIds = activeAssignments.map(assignment => assignment.id); await deleteTestingRecord(assignmentIds); - // Обновляем данные диалога после удаления всех назначений await openAddDialog(selectedTestId.value); showNotification('Все назначения успешно отменены', 'green'); diff --git a/sys/scripts/easyserver.sh b/sys/scripts/easyserver.sh index 2137c40e0..f5c0a4ae4 100755 --- a/sys/scripts/easyserver.sh +++ b/sys/scripts/easyserver.sh @@ -16,8 +16,6 @@ done shift $((OPTIND -1)) - - if [[ "${PRODUCTION}" != "False" ]]; then if [[ "$AUTO_CONFIRM" == false ]]; then read -p "Вы уверены, что хотите загрузить образы $COMPOSE_PROJECT_NAME? (y/n): " confirmation
{{ correctAnswers }}/{{ totalQuestions }}
{{ question.name }}
Выбранные сотрудники:
Выбрано {{ question.answers.length }} сотрудников