Skip to content

Commit

Permalink
zmrazovanie vysledkov
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe committed Dec 9, 2023
1 parent 3ed0659 commit fa8da22
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,17 @@ def semester_results(semester):
results.sort(key=itemgetter('total'), reverse=True)
results = utils.rank_results(results)
return results

@action(methods=['post'], detail=True, url_path='results/freeze')
def freeze_results(self, request: Request, pk: Optional[int] = None):
semester:Semester = self.get_object()
try:
semester.freeze_results(self.semester_results(semester))
except FreezingNotClosedResults as exc:
raise exceptions.MethodNotAllowed(
method='series/results/freeze',
detail='Semester nemá uzavreté všetky série a teda sa nedá uzavrieť.') from exc
return Response('Semester bol uzavretý', status=status.HTTP_200_OK)

@action(methods=['post'], detail=True, url_path='results/freeze')
def freeze_results(self, request: Request, pk: Optional[int] = None):
Expand Down

0 comments on commit fa8da22

Please sign in to comment.