Fix solution view

This commit is contained in:
Yohann D'ANELLO 2021-04-04 17:18:50 +02:00
parent de76abab5f
commit 30a0e63eb9
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 8 additions and 5 deletions

View File

@ -541,11 +541,14 @@ class SolutionView(LoginRequiredMixin, View):
raise Http404
solution = Solution.objects.get(file__endswith=filename)
user = request.user
passage_participant_qs = Passage.objects.filter(Q(defender=user.registration.team.participation)
| Q(opponent=user.registration.team.participation)
| Q(reporter=user.registration.team.participation),
defender=solution.participation,
solution_number=solution.problem)
if user.registration.participates:
passage_participant_qs = Passage.objects.filter(Q(defender=user.registration.team.participation)
| Q(opponent=user.registration.team.participation)
| Q(reporter=user.registration.team.participation),
defender=solution.participation,
solution_number=solution.problem)
else:
passage_participant_qs = Passage.objects.none()
if not (user.registration.is_admin or user.registration.is_volunteer
and Passage.objects.filter(Q(pool__juries=user.registration)
| Q(pool__tournament__in=user.registration.organized_tournaments.all()),