mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 17:42:24 +00:00
Juries have more rights
This commit is contained in:
parent
72519c3d30
commit
d89f2c266d
@ -157,6 +157,9 @@ class DocumentView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
if isinstance(doc, Solution):
|
if isinstance(doc, Solution):
|
||||||
for pool in doc.pools.all():
|
for pool in doc.pools.all():
|
||||||
|
if request.user in pool.juries:
|
||||||
|
grant = True
|
||||||
|
break
|
||||||
if pool.round == 2 and timezone.now() < doc.tournament.date_solutions_2:
|
if pool.round == 2 and timezone.now() < doc.tournament.date_solutions_2:
|
||||||
continue
|
continue
|
||||||
if self.request.user.team in pool.teams.all():
|
if self.request.user.team in pool.teams.all():
|
||||||
|
@ -255,9 +255,7 @@ class SolutionsView(TeamMixin, BaseFormView, SingleTableView):
|
|||||||
return context
|
return context
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset().filter(team=self.request.user.team)
|
||||||
if not self.request.user.admin:
|
|
||||||
qs = qs.filter(team=self.request.user.team)
|
|
||||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||||
'problem',)
|
'problem',)
|
||||||
|
|
||||||
@ -327,7 +325,7 @@ class SolutionsOrgaListView(OrgaMixin, SingleTableView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
if not self.request.user.admin:
|
if not self.request.user.admin:
|
||||||
qs = qs.filter(team__tournament__organizers=self.request.user)
|
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',
|
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||||
'problem',)
|
'problem',)
|
||||||
|
|
||||||
@ -360,9 +358,7 @@ class SynthesesView(TeamMixin, BaseFormView, SingleTableView):
|
|||||||
return super().post(request, *args, **kwargs)
|
return super().post(request, *args, **kwargs)
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset().filter(team=self.request.user.team)
|
||||||
if not self.request.user.admin:
|
|
||||||
qs = qs.filter(team=self.request.user.team)
|
|
||||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||||
'round', 'source',)
|
'round', 'source',)
|
||||||
|
|
||||||
@ -446,7 +442,7 @@ class SynthesesOrgaListView(OrgaMixin, SingleTableView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
qs = super().get_queryset()
|
qs = super().get_queryset()
|
||||||
if not self.request.user.admin:
|
if not self.request.user.admin:
|
||||||
qs = qs.filter(team__tournament__organizers=self.request.user)
|
qs = qs.filter(Q(team__tournament__organizers=self.request.user) | Q(team__pools__juries=self.request.user))
|
||||||
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
return qs.order_by('final', 'team__tournament__date_start', 'team__tournament__name', 'team__trigram',
|
||||||
'round', 'source',)
|
'round', 'source',)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user