From 230dc545f41c40095b6b7ea3ef7b9f2f5efc9c86 Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 20 May 2023 22:13:51 +0200 Subject: [PATCH] Fix export scripts Signed-off-by: Emmy D'Anello --- .../management/commands/export_results.py | 2 +- .../management/commands/export_solutions.py | 19 ++++--------------- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/participation/management/commands/export_results.py b/participation/management/commands/export_results.py index 2468f37..fcdaceb 100644 --- a/participation/management/commands/export_results.py +++ b/participation/management/commands/export_results.py @@ -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): diff --git a/participation/management/commands/export_solutions.py b/participation/management/commands/export_solutions.py index 067f9c4..d84ec5b 100644 --- a/participation/management/commands/export_solutions.py +++ b/participation/management/commands/export_solutions.py @@ -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():