Compare commits
3 Commits
6ce179bd60
...
a381b5583c
Author | SHA1 | Date |
---|---|---|
Emmy D'Anello | a381b5583c | |
Emmy D'Anello | 867ee7efe1 | |
Emmy D'Anello | 32b2d7239c |
|
@ -750,19 +750,19 @@ class Participation(models.Model):
|
|||
draw_url = reverse_lazy("draw:index")
|
||||
solution_url = reverse_lazy("participation:solution_detail", args=(defender_passage.defended_solution.pk,))
|
||||
defender_content = format_lazy(defender_text, draw_url=draw_url,
|
||||
solution_url=solution_url, problem=defender_passage.problem)
|
||||
solution_url=solution_url, problem=defender_passage.solution_number)
|
||||
|
||||
opponent_text = _("<p>You will oppose the solution of the team {opponent} on the problem {problem}. "
|
||||
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||
passage_url = reverse_lazy("participation:passage_detail", args=(opponent_passage.pk,))
|
||||
opponent_content = format_lazy(opponent_text, opponent=opponent_passage.defender.team.trigram,
|
||||
problem=opponent_passage.problem, passage_url=passage_url)
|
||||
problem=opponent_passage.solution_number, passage_url=passage_url)
|
||||
|
||||
reporter_text = _("<p>You will report the solution of the team {reporter} on the problem {problem}. "
|
||||
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||
passage_url = reverse_lazy("participation:passage_detail", args=(reporter_passage.pk,))
|
||||
reporter_content = format_lazy(reporter_text, reporter=reporter_passage.defender.team.trigram,
|
||||
problem=reporter_passage.problem, passage_url=passage_url)
|
||||
problem=reporter_passage.solution_number, passage_url=passage_url)
|
||||
|
||||
content = defender_content + opponent_content + reporter_content
|
||||
informations.append({
|
||||
|
@ -782,19 +782,19 @@ class Participation(models.Model):
|
|||
draw_url = reverse_lazy("draw:index")
|
||||
solution_url = reverse_lazy("participation:solution_detail", args=(defender_passage.defended_solution.pk,))
|
||||
defender_content = format_lazy(defender_text, draw_url=draw_url,
|
||||
solution_url=solution_url, problem=defender_passage.problem)
|
||||
solution_url=solution_url, problem=defender_passage.solution_number)
|
||||
|
||||
opponent_text = _("<p>You will oppose the solution of the team {opponent} on the problem {problem}. "
|
||||
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||
passage_url = reverse_lazy("participation:passage_detail", args=(opponent_passage.pk,))
|
||||
opponent_content = format_lazy(opponent_text, opponent=opponent_passage.defender.team.trigram,
|
||||
problem=opponent_passage.problem, passage_url=passage_url)
|
||||
problem=opponent_passage.solution_number, passage_url=passage_url)
|
||||
|
||||
reporter_text = _("<p>You will report the solution of the team {reporter} on the problem {problem}. "
|
||||
"You can upload your synthesis sheet on <a href='{passage_url}'>this page</a>.</p>")
|
||||
passage_url = reverse_lazy("participation:passage_detail", args=(reporter_passage.pk,))
|
||||
reporter_content = format_lazy(reporter_text, reporter=reporter_passage.defender.team.trigram,
|
||||
problem=reporter_passage.problem, passage_url=passage_url)
|
||||
problem=reporter_passage.solution_number, passage_url=passage_url)
|
||||
|
||||
content = defender_content + opponent_content + reporter_content
|
||||
informations.append({
|
||||
|
|
|
@ -1894,30 +1894,31 @@ class PassageDetailView(LoginRequiredMixin, DetailView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
reg = self.request.user.registration
|
||||
if reg in self.object.pool.juries.all():
|
||||
context["my_note"] = Note.objects.get_or_create(passage=self.object, jury=self.request.user.registration)[0]
|
||||
passage = self.object
|
||||
if reg in passage.pool.juries.all():
|
||||
context["my_note"] = Note.objects.get_or_create(passage=passage, jury=self.request.user.registration)[0]
|
||||
if reg.is_volunteer:
|
||||
notes = self.object.notes.all()
|
||||
notes = passage.notes.all()
|
||||
if not reg.is_admin \
|
||||
and (reg != self.object.pool.jury_president
|
||||
or reg not in self.object.pool.tournament.organizers.all()):
|
||||
and (reg != passage.pool.jury_president
|
||||
or reg not in passage.pool.tournament.organizers.all()):
|
||||
notes = [note for note in notes if note.has_any_note() or note.jury == reg]
|
||||
context["notes"] = NoteTable(notes)
|
||||
|
||||
# Only display the observer column for 4-teams pools
|
||||
if self.object.pool.participations.count() != 4:
|
||||
if passage.pool.participations.count() != 4:
|
||||
context['notes']._sequence.remove('observer_oral')
|
||||
if 'notes' in context and not self.request.user.registration.is_admin:
|
||||
context['notes']._sequence.remove('update')
|
||||
|
||||
context['notes'].columns['defender_writing'].column.verbose_name += f" ({self.object.defender.team.trigram})"
|
||||
context['notes'].columns['defender_oral'].column.verbose_name += f" ({self.object.defender.team.trigram})"
|
||||
context['notes'].columns['opponent_writing'].column.verbose_name += f" ({self.object.opponent.team.trigram})"
|
||||
context['notes'].columns['opponent_oral'].column.verbose_name += f" ({self.object.opponent.team.trigram})"
|
||||
context['notes'].columns['reporter_writing'].column.verbose_name += f" ({self.object.reporter.team.trigram})"
|
||||
context['notes'].columns['reporter_oral'].column.verbose_name += f" ({self.object.reporter.team.trigram})"
|
||||
if self.object.observer:
|
||||
context['notes'].columns['observer_oral'].column.verbose_name += f" ({self.object.observer.team.trigram})"
|
||||
context['notes'].columns['defender_writing'].column.verbose_name += f" ({passage.defender.team.trigram})"
|
||||
context['notes'].columns['defender_oral'].column.verbose_name += f" ({passage.defender.team.trigram})"
|
||||
context['notes'].columns['opponent_writing'].column.verbose_name += f" ({passage.opponent.team.trigram})"
|
||||
context['notes'].columns['opponent_oral'].column.verbose_name += f" ({passage.opponent.team.trigram})"
|
||||
context['notes'].columns['reporter_writing'].column.verbose_name += f" ({passage.reporter.team.trigram})"
|
||||
context['notes'].columns['reporter_oral'].column.verbose_name += f" ({passage.reporter.team.trigram})"
|
||||
if self.object.observer:
|
||||
context['notes'].columns['observer_oral'].column.verbose_name += f" ({passage.observer.team.trigram})"
|
||||
|
||||
return context
|
||||
|
||||
|
|
|
@ -800,7 +800,7 @@ class SolutionView(LoginRequiredMixin, View):
|
|||
or (user.registration.is_volunteer
|
||||
and user.registration in solution.tournament.organizers.all())
|
||||
or (user.registration.is_volunteer
|
||||
and user.registration.presided_pools.filter(tournament=solution.tournament).exists())
|
||||
and user.registration.pools_presided.filter(tournament=solution.tournament).exists())
|
||||
or user.registration.is_volunteer
|
||||
and Passage.objects.filter(Q(pool__juries=user.registration)
|
||||
| Q(pool__tournament__in=user.registration.organized_tournaments.all()),
|
||||
|
@ -836,7 +836,7 @@ class SynthesisView(LoginRequiredMixin, View):
|
|||
if not (user.registration.is_admin or user.registration.is_volunteer
|
||||
and (user.registration in synthesis.passage.pool.juries.all()
|
||||
or user.registration in synthesis.passage.pool.tournament.organizers.all()
|
||||
or user.registration.presided_pools.filter(tournament=synthesis.passage.pool.tournament).exists())
|
||||
or user.registration.pools_presided.filter(tournament=synthesis.passage.pool.tournament).exists())
|
||||
or user.registration.participates and user.registration.team == synthesis.participation.team):
|
||||
raise PermissionDenied
|
||||
# Guess mime type of the file
|
||||
|
|
Loading…
Reference in New Issue