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.translation import activate
from .models import Tournament
from participation.models import Tournament
class Command(BaseCommand):

View File

@ -3,29 +3,18 @@
from pathlib import Path
from django.conf import settings
from django.core.management import BaseCommand
from django.utils.translation import activate
from .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",
]
from participation.models import Solution, Tournament
class Command(BaseCommand):
def handle(self, *args, **kwargs):
activate('fr')
base_dir = Path(__file__).parent.parent.parent.parent.parent
base_dir = Path(__file__).parent.parent.parent.parent
base_dir /= "output"
if not base_dir.is_dir():
base_dir.mkdir()
@ -41,7 +30,7 @@ class Command(BaseCommand):
if not base_dir.is_dir():
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}"
problem_dir = base_dir / dir_name
if not problem_dir.is_dir():