1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 03:00:34 +02:00

Fix errors and better tab usage

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-03-22 20:41:16 +01:00
parent bde3758c50
commit 93a71fb561
4 changed files with 249 additions and 28 deletions

View File

@ -71,16 +71,17 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
.format(len=len(self.participations), sum=sum(fmt)), 'danger')
draw = await sync_to_async(Draw.objects.create)(tournament=self.tournament)
r = await sync_to_async(Round.objects.create)(draw=draw, number=1)
for i, f in enumerate(fmt):
sync_to_async(Pool.objects.create)(round=r, letter=i + 1, size=f)
for participation in self.participations:
sync_to_async(TeamDraw.objects.create)(participation=participation)
for i in [1, 2]:
r = await sync_to_async(Round.objects.create)(draw=draw, number=i)
for j, f in enumerate(fmt):
await sync_to_async(Pool.objects.create)(round=r, letter=j + 1, size=f)
for participation in self.participations:
await sync_to_async(TeamDraw.objects.create)(participation=participation)
await self.alert(_("Draw started!"), 'success')
await self.channel_layer.group_send(f"tournament-{self.tournament.id}",
{'type': 'draw.start', 'fmt': fmt, 'draw': draw, 'round': r})
{'type': 'draw.start', 'fmt': fmt, 'draw': draw})
async def draw_start(self, content):
await self.alert(_("The draw for the tournament {tournament} will start.")\