Add symlinks per problem
This commit is contained in:
parent
dd4171b0e8
commit
5ec2cf5acd
|
@ -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):
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
<div class="card-body">
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Templates for syntheses are available here:" %}
|
||||
<a data-turbolinks="false" href="{% static "Fiche synthèse.pdf" %}">PDF</a> -- <a data-turbolinks="false" href="{% static "Fiche synthèse.tex" %}">TEX</a>
|
||||
<a data-turbolinks="false" href="{% static "Fiche synthèse.pdf" %}">PDF</a> — <a data-turbolinks="false" href="{% static "Fiche synthèse.tex" %}">TEX</a>
|
||||
</div>
|
||||
{% if user.organizes or not user.is_authenticated %}
|
||||
<ul>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
{% block content %}
|
||||
<div class="alert alert-warning">
|
||||
{% trans "Templates for syntheses are available here:" %}
|
||||
<a data-turbolinks="false" href="{% static "Fiche synthèse.pdf" %}">PDF</a> -- <a data-turbolinks="false" href="{% static "Fiche synthèse.tex" %}">TEX</a>
|
||||
<a data-turbolinks="false" href="{% static "Fiche synthèse.pdf" %}">PDF</a> — <a data-turbolinks="false" href="{% static "Fiche synthèse.tex" %}">TEX</a>
|
||||
</div>
|
||||
|
||||
{% if form %}
|
||||
|
|
Loading…
Reference in New Issue