From 6082b8deaa408a9c0c83fe4424f07d0bb72c4a3e Mon Sep 17 00:00:00 2001 From: kovacspe Date: Sat, 9 Dec 2023 12:54:06 +0100 Subject: [PATCH] lint --- competition/models.py | 6 ++++-- competition/views.py | 11 ----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/competition/models.py b/competition/models.py index fc2e9be6..e617c26f 100644 --- a/competition/models.py +++ b/competition/models.py @@ -216,7 +216,6 @@ def save(self, *args, **kwargs) -> None: self.frozen_results = None return super().save(*args, **kwargs) - def get_first_series(self) -> 'Series': return self.series_set.get(order=1) @@ -322,7 +321,10 @@ def get_actual_late_flag(self) -> Optional[LateTag]: .first() def freeze_results(self, results): - if any(problem.num_solutions != problem.num_corrected_solutions for problem in self.problems.all()): + if any( + problem.num_solutions != problem.num_corrected_solutions + for problem in self.problems.all() + ): raise FreezingNotClosedResults() self.frozen_results = results diff --git a/competition/views.py b/competition/views.py index bea3e84e..30ccceae 100644 --- a/competition/views.py +++ b/competition/views.py @@ -627,17 +627,6 @@ 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):