From 05a69d68aa9bcbb58259a648f56e58a06bb67876 Mon Sep 17 00:00:00 2001 From: OhMaley Date: Wed, 30 Oct 2024 13:34:22 -0400 Subject: [PATCH 1/3] fix db inconsistency logs path finding --- src/apps/analytics/tasks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/analytics/tasks.py b/src/apps/analytics/tasks.py index 246dbb13e..8eb6f4c11 100644 --- a/src/apps/analytics/tasks.py +++ b/src/apps/analytics/tasks.py @@ -584,7 +584,7 @@ def delete_orphan_files(): raise Exception("No storage inconsistency log file found") # Get the list of orphan files from the content of the most recent log file - log_folder = "/app/logs/" + log_folder = "/app/var/logs/" orphan_files_path = get_files_path_from_orphan_log_file(os.path.join(log_folder, most_recent_log_file), logger) # Delete those files in batch (max 1000 element at once) @@ -598,7 +598,7 @@ def delete_orphan_files(): def get_most_recent_storage_inconsistency_log_file(logger): - log_folder = "/app/logs/" + log_folder = "/app/var/logs/" try: log_files = [f for f in os.listdir(log_folder) if os.path.isfile(os.path.join(log_folder, f))] except FileNotFoundError: From 8987d83ec23c50eb8a4ddea0799d6c63b7a14253 Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Tue, 5 Nov 2024 18:33:49 +0500 Subject: [PATCH 2/3] removed count from competition query to fix the codabench --- src/apps/api/views/competitions.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/apps/api/views/competitions.py b/src/apps/api/views/competitions.py index 2ce5f409f..6cd876d14 100644 --- a/src/apps/api/views/competitions.py +++ b/src/apps/api/views/competitions.py @@ -168,13 +168,13 @@ def get_queryset(self): 'phases__leaderboard__columns', 'collaborators', ) - qs = qs.annotate(participant_count=Count(F('participants'), distinct=True)) - qs = qs.annotate(submission_count=Count( - # Filtering out children submissions so we only count distinct submissions - Case( - When(phases__submissions__parent__isnull=True, then='phases__submissions__pk') - ), distinct=True) - ) + # qs = qs.annotate(participant_count=Count(F('participants'), distinct=True)) + # qs = qs.annotate(submission_count=Count( + # # Filtering out children submissions so we only count distinct submissions + # Case( + # When(phases__submissions__parent__isnull=True, then='phases__submissions__pk') + # ), distinct=True) + # ) # search_query is true when called from searchbar if search_query: From 8fe42746203f402f793b181588e26eba8a0e49d1 Mon Sep 17 00:00:00 2001 From: Ihsan Ullah Date: Tue, 5 Nov 2024 18:38:54 +0500 Subject: [PATCH 3/3] flake fixed --- src/apps/api/views/competitions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/api/views/competitions.py b/src/apps/api/views/competitions.py index 6cd876d14..02f0590c9 100644 --- a/src/apps/api/views/competitions.py +++ b/src/apps/api/views/competitions.py @@ -6,7 +6,7 @@ from django.http import HttpResponse from tempfile import SpooledTemporaryFile from django.db import IntegrityError -from django.db.models import Subquery, OuterRef, Count, Q, F, Case, When +from django.db.models import Subquery, OuterRef, Count, Q, F from django_filters.rest_framework import DjangoFilterBackend from drf_yasg.utils import swagger_auto_schema, no_body from rest_framework import status