diff --git a/docker-compose.yml b/docker-compose.yml index b80180df5..5fa877733 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -114,6 +114,7 @@ services: environment: - PGDATA=/var/lib/postgresql/data/pgdata - POSTGRES_PASSWORD=${DB_PASSWORD} + command: ["postgres", "-c", "log_statement=all", "-c", "log_destination=stderr"] ports: - 5432:5432 volumes: diff --git a/src/apps/api/serializers/submission_leaderboard.py b/src/apps/api/serializers/submission_leaderboard.py index f4d9594af..368f8fec4 100644 --- a/src/apps/api/serializers/submission_leaderboard.py +++ b/src/apps/api/serializers/submission_leaderboard.py @@ -20,7 +20,7 @@ class SubmissionLeaderBoardSerializer(serializers.ModelSerializer): display_name = serializers.CharField(source='owner.display_name') slug_url = serializers.CharField(source='owner.slug_url') organization = SimpleOrganizationSerializer(allow_null=True) - created_when = serializers.DateTimeField(format="%Y-%m-%d %H:%M") + created_when = serializers.DateTimeField() class Meta: model = Submission diff --git a/src/apps/api/serializers/submissions.py b/src/apps/api/serializers/submissions.py index 1f31fe2c3..5511c027e 100644 --- a/src/apps/api/serializers/submissions.py +++ b/src/apps/api/serializers/submissions.py @@ -26,7 +26,7 @@ class SubmissionSerializer(serializers.ModelSerializer): phase_name = serializers.CharField(source='phase.name') on_leaderboard = serializers.BooleanField(read_only=True) task = TaskSerializer() - created_when = serializers.DateTimeField(format="%Y-%m-%d %H:%M") + created_when = serializers.DateTimeField() auto_run = serializers.SerializerMethodField(read_only=True) can_make_submissions_public = serializers.SerializerMethodField(read_only=True) diff --git a/src/apps/api/views/analytics.py b/src/apps/api/views/analytics.py index 01b477748..c102135cb 100644 --- a/src/apps/api/views/analytics.py +++ b/src/apps/api/views/analytics.py @@ -221,6 +221,7 @@ def competitions_usage(request): query = CompetitionStorageDataPoint.objects.filter( at_date__range=(start_date, end_date), + competition__isnull=False ).dates("at_date", resolution).values( 'id', 'competition__id', @@ -267,6 +268,7 @@ def users_usage(request): query = UserStorageDataPoint.objects.filter( at_date__range=(start_date, end_date), + user__isnull=False ).dates("at_date", resolution).values( 'id', 'user__id', diff --git a/src/apps/api/views/competitions.py b/src/apps/api/views/competitions.py index 02f0590c9..c34eec48e 100644 --- a/src/apps/api/views/competitions.py +++ b/src/apps/api/views/competitions.py @@ -34,7 +34,6 @@ from leaderboards.models import Leaderboard from utils.data import make_url_sassy from api.permissions import IsOrganizerOrCollaborator -from datetime import datetime from django.db import transaction from django.conf import settings @@ -271,8 +270,8 @@ def update(self, request, *args, **kwargs): new_phase_obj = Phase.objects.create( status=phase["status"], index=phase["index"], - start=datetime.strptime(phase['start'], "%B %d, %Y"), - end=datetime.strptime(phase['end'], "%B %d, %Y") if phase['end'] else None, + start=phase['start'], + end=phase['end'] if phase['end'] else None, name=phase["name"], description=phase["description"], hide_output=phase["hide_output"], @@ -706,15 +705,15 @@ def get_leaderboard(self, request, pk): # - child submissions (submissions who has a parent i.e. parent field is not null) # - Failed submissions # - Cancelled submissions - num_entries = Submission.objects.filter( - Q(owner__username=submission['owner']) | - Q(parent__owner__username=submission['owner']), - phase=phase, - ).exclude( - Q(status=Submission.FAILED) | - Q(status=Submission.CANCELLED) | - Q(parent__isnull=False) - ).count() + # num_entries = Submission.objects.filter( + # Q(owner__username=submission['owner']) | + # Q(parent__owner__username=submission['owner']), + # phase=phase, + # ).exclude( + # Q(status=Submission.FAILED) | + # Q(status=Submission.CANCELLED) | + # Q(parent__isnull=False) + # ).count() submission_key = f"{submission['owner']}{submission['parent'] or submission['id']}" @@ -738,7 +737,7 @@ def get_leaderboard(self, request, pk): 'fact_sheet_answers': submission['fact_sheet_answers'], 'slug_url': submission['slug_url'], 'organization': submission['organization'], - 'num_entries': num_entries, + # 'num_entries': num_entries, 'created_when': submission['created_when'] }) for score in submission['scores']: diff --git a/src/static/riot/competitions/detail/_tabs.tag b/src/static/riot/competitions/detail/_tabs.tag index b21f1aac1..0d3d649ec 100644 --- a/src/static/riot/competitions/detail/_tabs.tag +++ b/src/static/riot/competitions/detail/_tabs.tag @@ -412,7 +412,7 @@ }) self.pretty_date = function (date_string) { - if (!!date_string) { + if (date_string != null) { return luxon.DateTime.fromISO(date_string).toLocaleString(luxon.DateTime.DATETIME_FULL) } else { return '' diff --git a/src/static/riot/competitions/detail/leaderboards.tag b/src/static/riot/competitions/detail/leaderboards.tag index 7ddef46ea..25cc1e99a 100644 --- a/src/static/riot/competitions/detail/leaderboards.tag +++ b/src/static/riot/competitions/detail/leaderboards.tag @@ -34,7 +34,6 @@