Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe committed Dec 9, 2023
1 parent 6082b8d commit 117fb93
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
17 changes: 14 additions & 3 deletions competition/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,15 @@ class Meta:

@ts_interface(context='competition')
class SeriesSerializer(serializers.ModelSerializer):
complete = serializers.SerializerMethodField('get_complete')

class Meta:
model = models.Series
exclude = ['sum_method']
read_only_fields = ['complete']
fields = ['semester', 'order', 'deadline', 'complete']

def get_complete(self, obj: models.Series):
return obj.complete


@ts_interface(context='competition')
Expand Down Expand Up @@ -284,15 +290,20 @@ class SeriesWithProblemsSerializer(ModelWithParticipationSerializer):
)
can_submit = serializers.SerializerMethodField('get_can_submit')
can_resubmit = serializers.SerializerMethodField('get_can_resubmit')
complete = serializers.SerializerMethodField('get_complete')

class Meta:
model = models.Series
exclude = ['sum_method']
read_only_fields = ['semester']
exclude = ['sum_method', 'frozen_results']
include = ['complete']
read_only_fields = ['semester', 'complete']

def get_can_submit(self, obj):
return obj.can_submit

def get_complete(self, obj: models.Series):
return obj.complete

def get_can_resubmit(self, obj):
return obj.can_resubmit

Expand Down
2 changes: 0 additions & 2 deletions competition/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'order',
'deadline',
'complete',
'frozen_results',
'semester',
]

Expand Down Expand Up @@ -47,7 +46,6 @@
'start',
'end',
'season_code',
'frozen_results',
'competition',
'late_tags',
]
Expand Down
2 changes: 1 addition & 1 deletion competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def current(self, request, competition_id=None):
"""Vráti aktuálnu sériu"""
items = Semester.objects.filter(
competition=competition_id
).current().series_set.filter(complete=False)\
).current().series_set.filter(frozen_results__isnull=True)\
.order_by('-deadline')\
.first()
serializer = SeriesWithProblemsSerializer(items, many=False)
Expand Down

0 comments on commit 117fb93

Please sign in to comment.