Better final handle
This commit is contained in:
parent
d3412f3963
commit
495f42e594
|
@ -105,6 +105,10 @@ class TournamentDetailView(DetailView):
|
|||
|
||||
context["title"] = _("Tournament of {name}").format(name=self.object.name)
|
||||
|
||||
if self.object.final:
|
||||
team_users = TFJMUser.objects.filter(team__selected_for_final=True)
|
||||
valid_team_users = team_users
|
||||
else:
|
||||
team_users = TFJMUser.objects.filter(
|
||||
Q(team__tournament=self.object)
|
||||
| Q(organized_tournaments=self.object)).order_by('role')
|
||||
|
@ -403,6 +407,10 @@ class SolutionsOrgaListView(OrgaMixin, SingleTableView):
|
|||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
if self.request.user in Tournament.get_final().organizers.all():
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(pools__juries=self.request.user)
|
||||
| Q(final=True))
|
||||
else:
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(pools__juries=self.request.user))
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'problem',).distinct()
|
||||
|
@ -529,7 +537,11 @@ class SynthesesOrgaListView(OrgaMixin, SingleTableView):
|
|||
def get_queryset(self):
|
||||
qs = super().get_queryset()
|
||||
if not self.request.user.admin:
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(team__pools__juries=self.request.user))
|
||||
if self.request.user in Tournament.get_final().organizers.all():
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(pools__juries=self.request.user)
|
||||
| Q(final=True))
|
||||
else:
|
||||
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(pools__juries=self.request.user))
|
||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||
'round', 'source',).distinct()
|
||||
|
||||
|
|
Loading…
Reference in New Issue