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

Add comments and linting

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-05 17:52:46 +02:00
parent 2840a15fd5
commit 7e212d011e
14 changed files with 166 additions and 147 deletions

View File

@ -3,14 +3,13 @@
from asgiref.sync import sync_to_async
from django.conf import settings
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.db.models import QuerySet
from django.urls import reverse_lazy
from django.utils.text import format_lazy, slugify
from django.utils.translation import gettext_lazy as _
from participation.models import Passage, Participation, Pool as PPool, Tournament
from participation.models import Participation, Passage, Pool as PPool, Tournament
class Draw(models.Model):
@ -292,16 +291,16 @@ class Pool(models.Model):
Returns a list of trigrams of the teams in this pool ordered by passage index.
This property is synchronous.
"""
return [td.participation.team.trigram for td in self.teamdraw_set.order_by('passage_index')\
.prefetch_related('participation__team').all()]
return [td.participation.team.trigram for td in self.teamdraw_set.order_by('passage_index')
.prefetch_related('participation__team').all()]
async def atrigrams(self) -> list[str]:
"""
Returns a list of trigrams of the teams in this pool ordered by passage index.
This property is asynchronous.
"""
return [td.participation.team.trigram async for td in self.teamdraw_set.order_by('passage_index')\
.prefetch_related('participation__team').all()]
return [td.participation.team.trigram async for td in self.teamdraw_set.order_by('passage_index')
.prefetch_related('participation__team').all()]
async def next_td(self) -> "TeamDraw":
"""
@ -349,8 +348,8 @@ class Pool(models.Model):
# Define the participations of the pool
tds = [td async for td in self.team_draws.prefetch_related('participation')]
await self.associated_pool.participations.aset([td.participation async for td in self.team_draws\
.prefetch_related('participation')])
await self.associated_pool.participations.aset([td.participation async for td in self.team_draws
.prefetch_related('participation')])
await self.asave()
# Define the passage matrix according to the number of teams