1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2024-12-25 17:42:24 +00:00

Fix export scripts

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2023-05-20 22:13:51 +02:00
parent 20daecf619
commit 230dc545f4
Signed by: ynerant
GPG Key ID: 3A75C55819C8CF85
2 changed files with 5 additions and 16 deletions

View File

@ -5,7 +5,7 @@ from django.core.management import BaseCommand
from django.utils.formats import date_format from django.utils.formats import date_format
from django.utils.translation import activate from django.utils.translation import activate
from .models import Tournament from participation.models import Tournament
class Command(BaseCommand): class Command(BaseCommand):

View File

@ -3,29 +3,18 @@
from pathlib import Path from pathlib import Path
from django.conf import settings
from django.core.management import BaseCommand from django.core.management import BaseCommand
from django.utils.translation import activate from django.utils.translation import activate
from .models import Solution, Tournament from participation.models import Solution, Tournament
PROBLEMS = [
"Pliage de polygones",
"Mélodie des hirondelles",
"Professeur confiné",
"Nain sans mémoire",
"Bricolage microscopique",
"Villes jumelées",
"Promenade de chiens",
"Persée et la Gorgone",
]
class Command(BaseCommand): class Command(BaseCommand):
def handle(self, *args, **kwargs): def handle(self, *args, **kwargs):
activate('fr') activate('fr')
base_dir = Path(__file__).parent.parent.parent.parent.parent base_dir = Path(__file__).parent.parent.parent.parent
base_dir /= "output" base_dir /= "output"
if not base_dir.is_dir(): if not base_dir.is_dir():
base_dir.mkdir() base_dir.mkdir()
@ -41,7 +30,7 @@ class Command(BaseCommand):
if not base_dir.is_dir(): if not base_dir.is_dir():
base_dir.mkdir() base_dir.mkdir()
for problem_id, problem_name in enumerate(PROBLEMS): for problem_id, problem_name in enumerate(settings.PROBLEMS):
dir_name = f"Problème n°{problem_id + 1} : {problem_name}" dir_name = f"Problème n°{problem_id + 1} : {problem_name}"
problem_dir = base_dir / dir_name problem_dir = base_dir / dir_name
if not problem_dir.is_dir(): if not problem_dir.is_dir():