Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kovacspe committed Dec 9, 2023
1 parent 57b9f78 commit 6082b8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
6 changes: 4 additions & 2 deletions competition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions competition/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6082b8d

Please sign in to comment.