1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-24 09:08:50 +02:00

Add multiple sheets for 5-teams pools

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-06 23:58:59 +02:00
parent 5f09c35dee
commit 1ed4e9c17a
5 changed files with 102 additions and 73 deletions

View File

@ -828,7 +828,18 @@ class NotationSheetTemplateView(VolunteerMixin, DetailView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['esp'] = self.object.passages.count() * '&'
passages = self.object.passages.all()
if passages.count() == 5:
page = self.request.GET.get('page', '1')
if not page.isnumeric() or page not in ['1', '2']:
page = '1'
passages = passages.filter(id__in=[passages[0].id, passages[2].id, passages[4].id]
if page == '1' else [passages[1].id, passages[3].id])
context['page'] = page
context['passages'] = passages
context['esp'] = passages.count() * '&'
context['is_jury'] = self.request.user.registration in self.object.juries.all() \
and 'blank' not in self.request.GET
context['tfjm_number'] = timezone.now().year - 2010