mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-21 13:18:25 +02:00
Add symlinks per problem
This commit is contained in:
@ -3,11 +3,22 @@ from shutil import copyfile
|
||||
|
||||
from django.core.management import BaseCommand
|
||||
from django.utils import translation
|
||||
|
||||
from member.models import Solution
|
||||
from tournament.models import Tournament
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
PROBLEMS = [
|
||||
'Création de puzzles',
|
||||
'Départ en vacances',
|
||||
'Un festin stratégique',
|
||||
'Sauver les meubles',
|
||||
'Prêt à décoller !',
|
||||
'Ils nous espionnent !',
|
||||
'De joyeux bûcherons',
|
||||
'Robots auto-réplicateurs',
|
||||
]
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('dir',
|
||||
type=str,
|
||||
@ -43,3 +54,15 @@ class Command(BaseCommand):
|
||||
copied += 1
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Successfully copied {copied} solutions!".format(copied=copied)))
|
||||
|
||||
os.mkdir(d + '/Par problème')
|
||||
|
||||
for pb in range(1, 9):
|
||||
sols = Solution.objects.filter(problem=pb).all()
|
||||
pbdir = d + '/Par problème/Problème n°{number} — {problem}'.format(number=pb, problem=self.PROBLEMS[pb - 1])
|
||||
os.mkdir(pbdir)
|
||||
for sol in sols:
|
||||
os.symlink('../../' + sol.tournament.name + '/' + str(sol.team) + '/' + str(sol) + '.pdf',
|
||||
pbdir + '/' + str(sol) + '.pdf')
|
||||
|
||||
self.stdout.write(self.style.SUCCESS("Symlinks by problem created!"))
|
||||
|
@ -303,7 +303,7 @@ class Team(models.Model):
|
||||
send_mail(subject, message, "contact@tfjm.org", [user.email], html_message=message_html)
|
||||
|
||||
def __str__(self):
|
||||
return self.trigram + " -- " + self.name
|
||||
return self.trigram + " — " + self.name
|
||||
|
||||
|
||||
class Pool(models.Model):
|
||||
|
Reference in New Issue
Block a user