From 0b2d43bd6ab0d733b24e92c2a7e30023e797fec1 Mon Sep 17 00:00:00 2001 From: Timur Date: Sun, 2 Mar 2025 17:23:48 +0300 Subject: [PATCH 1/6] fix attachments fetch --- services/backend/api/v1/task/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/backend/api/v1/task/views.py b/services/backend/api/v1/task/views.py index f918526..561df4f 100644 --- a/services/backend/api/v1/task/views.py +++ b/services/backend/api/v1/task/views.py @@ -155,5 +155,5 @@ def get_submissions_history(request, competition_id: UUID, task_id: UUID): def get_task_attachments(request, competition_id: UUID, task_id: UUID): task = get_object_or_404(CompetitionTask, id=task_id) return status.OK, CompetitionTaskAttachment.objects.filter( - competition_id=competition_id, task=task, user=request.auth - ) + task=task, user=request.auth + ).all() From 929342cf68204aac771c4d0bed27e62b6986c67e Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 17:24:19 +0300 Subject: [PATCH 2/6] antifrodpobeda --- services/backend/integrations/checker/healthcheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/backend/integrations/checker/healthcheck.py b/services/backend/integrations/checker/healthcheck.py index 492e127..1ab32f5 100644 --- a/services/backend/integrations/checker/healthcheck.py +++ b/services/backend/integrations/checker/healthcheck.py @@ -11,7 +11,7 @@ class CheckerHealthCheck(BaseHealthCheckBackend): def check_status(self) -> None: try: response = httpx.get( - f"{settings.ANTIFRAUD_ADDRESS}/ping", timeout=1 + f"{settings.CHECKER_API_ENDPOINT}/ping", timeout=1 ) if response.status_code >= status.INTERNAL_SERVER_ERROR: self.add_error("Checker service is unaccessible") From f34b3816c7224c6966d1c9a4c2e423adc5087215 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 17:24:56 +0300 Subject: [PATCH 3/6] (scope): [body] [footer(s)] --- compose.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/compose.yaml b/compose.yaml index 7eaa8c7..95f3070 100644 --- a/compose.yaml +++ b/compose.yaml @@ -376,6 +376,12 @@ services: context: ./services/checker dockerfile: Dockerfile restart: unless-stopped + ports: + - name: web + target: 8000 + published: 8009 + host_ip: 0.0.0.0 + protocol: tcp volumes: - type: bind source: /var/run/docker.sock From c54161a470fe59ba3f2d0bc9afa5fe9109930dc2 Mon Sep 17 00:00:00 2001 From: ITQ Date: Sun, 2 Mar 2025 17:35:27 +0300 Subject: [PATCH 4/6] well, well --- compose.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compose.yaml b/compose.yaml index 95f3070..e4401a3 100644 --- a/compose.yaml +++ b/compose.yaml @@ -385,7 +385,7 @@ services: volumes: - type: bind source: /var/run/docker.sock - target: /prometheus + target: /var/run/docker.sock proxy: image: docker.io/nginx:1.27-alpine3.21 From b6183b406a95acfb313a8b91fa40b2a6ae5bfb1e Mon Sep 17 00:00:00 2001 From: Timur Date: Sun, 2 Mar 2025 17:38:45 +0300 Subject: [PATCH 5/6] fix of getting task attachments --- services/backend/api/v1/task/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/backend/api/v1/task/views.py b/services/backend/api/v1/task/views.py index 561df4f..91f7477 100644 --- a/services/backend/api/v1/task/views.py +++ b/services/backend/api/v1/task/views.py @@ -155,5 +155,5 @@ def get_submissions_history(request, competition_id: UUID, task_id: UUID): def get_task_attachments(request, competition_id: UUID, task_id: UUID): task = get_object_or_404(CompetitionTask, id=task_id) return status.OK, CompetitionTaskAttachment.objects.filter( - task=task, user=request.auth + task=task ).all() From 52cb8f72ce03195b7a59549b568844ba147caa4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=A1=D1=83=D0=BC?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sun, 2 Mar 2025 17:41:56 +0300 Subject: [PATCH 6/6] feat: fixed review not adding if reviewer added after creating --- services/backend/apps/review/apps.py | 3 +++ services/backend/apps/review/signals.py | 14 ++++++++++++++ services/backend/apps/task/models.py | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 services/backend/apps/review/signals.py diff --git a/services/backend/apps/review/apps.py b/services/backend/apps/review/apps.py index 27080a3..138bf7f 100644 --- a/services/backend/apps/review/apps.py +++ b/services/backend/apps/review/apps.py @@ -5,3 +5,6 @@ class CoreConfig(AppConfig): name = "apps.review" label = "review" verbose_name = "Проверка" + + def ready(self): + import apps.review.signals diff --git a/services/backend/apps/review/signals.py b/services/backend/apps/review/signals.py new file mode 100644 index 0000000..44da6c2 --- /dev/null +++ b/services/backend/apps/review/signals.py @@ -0,0 +1,14 @@ +# myapp/signals.py +from django.db.models.signals import m2m_changed +from django.dispatch import receiver + +from apps.review.models import Review +from apps.task.models import CompetitionTask, CompetitionTaskSubmission + + +@receiver(m2m_changed, sender=CompetitionTask.reviewers.through) +def print_reviewers(sender, instance, action, **kwargs): + if action in ['post_add', 'post_remove', 'post_clear']: + submissions = CompetitionTaskSubmission.objects.filter(task=instance) + for submission in submissions: + submission.send_on_review() \ No newline at end of file diff --git a/services/backend/apps/task/models.py b/services/backend/apps/task/models.py index 17232b8..dc917ef 100644 --- a/services/backend/apps/task/models.py +++ b/services/backend/apps/task/models.py @@ -182,7 +182,7 @@ class CompetitionTaskSubmission(BaseModel): ] # да это медленно работает и чо for reviewer in reviewers: - Review.objects.create( + Review.objects.update_or_create( reviewer=reviewer, submission=self, )