mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 05:18:26 +02:00
Add observer notes
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
@ -353,6 +353,7 @@ class Pool(models.Model):
|
||||
await self.asave()
|
||||
|
||||
# Define the passage matrix according to the number of teams
|
||||
table = []
|
||||
if self.size == 3:
|
||||
table = [
|
||||
[0, 1, 2],
|
||||
@ -361,10 +362,10 @@ class Pool(models.Model):
|
||||
]
|
||||
elif self.size == 4:
|
||||
table = [
|
||||
[0, 1, 2],
|
||||
[1, 2, 3],
|
||||
[2, 3, 0],
|
||||
[3, 0, 1],
|
||||
[0, 1, 2, 3],
|
||||
[1, 2, 3, 0],
|
||||
[2, 3, 0, 1],
|
||||
[3, 0, 1, 2],
|
||||
]
|
||||
elif self.size == 5:
|
||||
table = [
|
||||
@ -377,7 +378,7 @@ class Pool(models.Model):
|
||||
|
||||
for i, line in enumerate(table):
|
||||
# Create the passage
|
||||
await Passage.objects.acreate(
|
||||
passage = await Passage.objects.acreate(
|
||||
pool=self.associated_pool,
|
||||
position=i + 1,
|
||||
solution_number=tds[line[0]].accepted,
|
||||
@ -386,6 +387,10 @@ class Pool(models.Model):
|
||||
reporter=tds[line[2]].participation,
|
||||
defender_penalties=tds[line[0]].penalty_int,
|
||||
)
|
||||
if self.size == 4:
|
||||
# Add observer for 4-teams pools
|
||||
passage.observer = tds[line[3]].participation
|
||||
await passage.asave()
|
||||
|
||||
return self.associated_pool
|
||||
|
||||
|
Reference in New Issue
Block a user