Allow observers to access solutions

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2024-07-05 12:02:08 +02:00
parent d20d5f6266
commit 3f2a757414
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
1 changed files with 3 additions and 2 deletions

View File

@ -836,10 +836,11 @@ class SolutionView(LoginRequiredMixin, View):
raise Http404
solution = Solution.objects.get(file__endswith=filename)
user = request.user
if user.registration.participates:
if user.registration.participates and user.registration.team.participation:
passage_participant_qs = Passage.objects.filter(Q(defender=user.registration.team.participation)
| Q(opponent=user.registration.team.participation)
| Q(reviewer=user.registration.team.participation),
| Q(reviewer=user.registration.team.participation)
| Q(observer=user.registration.team.participation),
defender=solution.participation,
solution_number=solution.problem)
else: