mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 16:38:23 +02:00
Send syntheses
This commit is contained in:
@ -263,7 +263,7 @@ class Command(BaseCommand):
|
||||
obj_dict = {
|
||||
"file": args[0],
|
||||
"team": Team.objects.get(pk=args[1]),
|
||||
"dest": "defender" if args[3] == "DEFENDER" else "opponent"
|
||||
"source": "defender" if args[3] == "DEFENDER" else "opponent"
|
||||
if args[4] == "OPPOSANT" else "rapporteur",
|
||||
"uploaded_at": args[4],
|
||||
}
|
||||
|
@ -243,6 +243,10 @@ class Solution(Document):
|
||||
verbose_name=_("final solution"),
|
||||
)
|
||||
|
||||
@property
|
||||
def tournament(self):
|
||||
return Tournament.get_final() if self.final else self.team.tournament
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("solution")
|
||||
verbose_name_plural = _("solutions")
|
||||
@ -261,14 +265,14 @@ class Synthesis(Document):
|
||||
verbose_name=_("team"),
|
||||
)
|
||||
|
||||
dest = models.CharField(
|
||||
source = models.CharField(
|
||||
max_length=16,
|
||||
choices=[
|
||||
("defender", _("Defender")),
|
||||
("opponent", _("Opponent")),
|
||||
("rapporteur", _("Rapporteur")),
|
||||
],
|
||||
verbose_name=_("dest"),
|
||||
verbose_name=_("source"),
|
||||
)
|
||||
|
||||
round = models.PositiveSmallIntegerField(
|
||||
@ -284,14 +288,18 @@ class Synthesis(Document):
|
||||
verbose_name=_("final synthesis"),
|
||||
)
|
||||
|
||||
@property
|
||||
def tournament(self):
|
||||
return Tournament.get_final() if self.final else self.team.tournament
|
||||
|
||||
class Meta:
|
||||
verbose_name = _("synthesis")
|
||||
verbose_name_plural = _("syntheses")
|
||||
unique_together = ('team', 'dest', 'round', 'final',)
|
||||
unique_together = ('team', 'source', 'round', 'final',)
|
||||
|
||||
def __str__(self):
|
||||
return _("Synthesis of team {trigram} that is {dest} for problem {problem}")\
|
||||
.format(trigram=self.team.trigram, dest=self.dest, problem=self.problem)
|
||||
return _("Synthesis of team {trigram} that is {source} for the tournament {tournament}")\
|
||||
.format(trigram=self.team.trigram, source=self.source, tournament=self.tournament)
|
||||
|
||||
|
||||
class Config(models.Model):
|
||||
|
Reference in New Issue
Block a user