mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 00:52:03 +01:00 
			
		
		
		
	Add information to teams and juries about pools
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
		@@ -17,6 +17,8 @@ from django.utils.text import format_lazy
 | 
			
		||||
from django.utils.translation import gettext_lazy as _
 | 
			
		||||
from phonenumber_field.modelfields import PhoneNumberField
 | 
			
		||||
from polymorphic.models import PolymorphicModel
 | 
			
		||||
 | 
			
		||||
from participation.models import Note
 | 
			
		||||
from tfjm import helloasso
 | 
			
		||||
from tfjm.tokens import email_validation_token
 | 
			
		||||
 | 
			
		||||
@@ -513,6 +515,59 @@ class VolunteerRegistration(Registration):
 | 
			
		||||
                    'content': content,
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
            if timezone.now() > tournament.solution_limit and timezone.now() < tournament.solutions_draw:
 | 
			
		||||
                text = _("<p>The draw of the solutions for the tournament {tournament} is planned on the "
 | 
			
		||||
                         "{date:%Y-%m-%d %H:%M}. You can join it on <a href='{url}'>this link</a>.</p>")
 | 
			
		||||
                url = reverse_lazy("draw:index")
 | 
			
		||||
                content = format_lazy(text, tournament=self.tournament.name, date=self.tournament.solutions_draw,
 | 
			
		||||
                                      url=url)
 | 
			
		||||
                informations.append({
 | 
			
		||||
                    'title': _("Draw of solutions"),
 | 
			
		||||
                    'type': "info",
 | 
			
		||||
                    'priority': 1,
 | 
			
		||||
                    'content': content,
 | 
			
		||||
                })
 | 
			
		||||
 | 
			
		||||
            pools = tournament.pools.filter(juries=self).order_by('round').all()
 | 
			
		||||
            for pool in pools:
 | 
			
		||||
                if pool.round == 1 and timezone.now().date() <= tournament.date_start:
 | 
			
		||||
                    text = _("<p>You are in the jury of the pool {pool} for the tournament of {tournament}. "
 | 
			
		||||
                             "You can find the pool page <a href='{pool_url}'>here</a>.</p>")
 | 
			
		||||
                    pool_url = reverse_lazy("participation:pool_detail", args=(pool.id,))
 | 
			
		||||
                    content = format_lazy(text, pool=pool.short_name, tournament=tournament.name, pool_url=pool_url)
 | 
			
		||||
                    informations.append({
 | 
			
		||||
                        'title': _("First round"),
 | 
			
		||||
                        'type': "info",
 | 
			
		||||
                        'priority': 1,
 | 
			
		||||
                        'content': content,
 | 
			
		||||
                    })
 | 
			
		||||
                elif pool.round == 2 and timezone.now().date() <= tournament.date_end:
 | 
			
		||||
                    text = _("<p>You are in the jury of the pool {pool} for the tournament of {tournament}. "
 | 
			
		||||
                             "You can find the pool page <a href='{pool_url}'>here</a>.</p>")
 | 
			
		||||
                    pool_url = reverse_lazy("participation:pool_detail", args=(pool.id,))
 | 
			
		||||
                    content = format_lazy(text, pool=pool.short_name, tournament=tournament.name, pool_url=pool_url)
 | 
			
		||||
                    informations.append({
 | 
			
		||||
                        'title': _("Second round"),
 | 
			
		||||
                        'type': "info",
 | 
			
		||||
                        'priority': 2,
 | 
			
		||||
                        'content': content,
 | 
			
		||||
                    })
 | 
			
		||||
 | 
			
		||||
                for note in Note.objects.filter(jury=self.request.user, passage__pool=pool).all():
 | 
			
		||||
                    if not note.has_any_note():
 | 
			
		||||
                        text = _("<p>You don't have given any note as a jury for the passage {passage} "
 | 
			
		||||
                                 "in the pool {pool} of {tournament}. "
 | 
			
		||||
                                 "You can set your notes <a href='{passage_url}'>here</a>.</p>")
 | 
			
		||||
                        passage_url = reverse_lazy("participation:passage_detail", args=(note.passage.id,))
 | 
			
		||||
                        content = format_lazy(text, passage=note.passage.position, pool=pool.short_name,
 | 
			
		||||
                                              tournament=tournament.name, passage_url=passage_url)
 | 
			
		||||
                        informations.append({
 | 
			
		||||
                            'title': _("Note"),
 | 
			
		||||
                            'type': "warning",
 | 
			
		||||
                            'priority': 3 + note.passage.position,
 | 
			
		||||
                            'content': content,
 | 
			
		||||
                        })
 | 
			
		||||
 | 
			
		||||
        return informations
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user