Skip to content

Commit b5d75ec

Browse files
authored
Prepisovanie rieseni (#369)
1 parent 6b9be65 commit b5d75ec

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

competition/views.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ class ProblemViewSet(ModelViewSetWithSerializerContext):
196196
queryset = Problem.objects.all()
197197
serializer_class = ProblemSerializer
198198
permission_classes = (ProblemPermission,)
199-
MAX_SUBMITTED_SOLUTIONS = 10
200199

201200
def perform_create(self, serializer):
202201
"""
@@ -271,18 +270,14 @@ def upload_solution(self, request, pk=None):
271270
if len(existing_solutions) > 0 and late_tag is not None and not late_tag.can_resubmit:
272271
raise exceptions.ValidationError(
273272
detail='Túto úlohu už nie je možné odovzdať znova.')
273+
Solution.objects.filter(
274+
problem=problem, semester_registration=event_registration).delete()
274275
solution = Solution.objects.create(
275276
problem=problem,
276277
semester_registration=event_registration,
277278
late_tag=late_tag,
278279
is_online=True
279280
)
280-
281-
# delete solutions until there is less than allowed amount
282-
while len(existing_solutions) > self.MAX_SUBMITTED_SOLUTIONS - 1:
283-
Solution.objects.filter(
284-
problem=problem, semester_registration=event_registration)\
285-
.earliest('uploaded_at').delete()
286281
solution.solution.save(
287282
solution.get_solution_file_name(), file, save=True)
288283

0 commit comments

Comments
 (0)