Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello 2022-11-08 15:52:44 +01:00
parent 8350960d5f
commit 815206a0a5
7 changed files with 72 additions and 71 deletions

View File

@ -2,8 +2,8 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import csv
import re
from io import StringIO
import re
from typing import Iterable
from bootstrap_datepicker_plus.widgets import DatePickerInput, DateTimePickerInput
@ -14,8 +14,8 @@ from django.core.validators import FileExtensionValidator
from django.utils import formats
from django.utils.translation import gettext_lazy as _
from PyPDF3 import PdfFileReader
from registration.models import VolunteerRegistration
from .models import Note, Participation, Passage, Pool, Solution, Synthesis, Team, Tournament

View File

@ -1,14 +1,11 @@
# Copyright (C) 2021 by Animath
# SPDX-License-Identifier: GPL-3.0-or-later
import os
from django.contrib.auth.models import User
from django.core.management import BaseCommand
from django.utils.formats import date_format
from django.utils.translation import activate
from participation.models import Tournament
from .models import Tournament
class Command(BaseCommand):
@ -42,9 +39,12 @@ class Command(BaseCommand):
self.w("")
self.w("<!-- wp:paragraph -->")
if tournament.final:
self.w(f"<p>La finale a eu lieu le weekend du {date_start} au {date_end} et a été remporté par l'équipe <em>{notes[0][0].team.name}</em> suivie de l'équipe <em>{notes[1][0].team.name}</em>. Les deux premières équipes sont sélectionnées pour représenter la France lors de l'ITYM.</p>")
self.w(f"<p>La finale a eu lieu le weekend du {date_start} au {date_end} et a été remporté par l'équipe "
f"<em>{notes[0][0].team.name}</em> suivie de l'équipe <em>{notes[1][0].team.name}</em>. "
f"Les deux premières équipes sont sélectionnées pour représenter la France lors de l'ITYM.</p>")
else:
self.w(f"<p>Le tournoi de {name} a eu lieu le weekend du {date_start} au {date_end} et a été remporté par l'équipe <em>{notes[0][0].team.name}</em>.</p>")
self.w(f"<p>Le tournoi de {name} a eu lieu le weekend du {date_start} au {date_end} et a été remporté par "
f"l'équipe <em>{notes[0][0].team.name}</em>.</p>")
self.w("<!-- /wp:paragraph -->")
self.w("")
self.w("")

View File

@ -3,12 +3,22 @@
from pathlib import Path
from django.contrib.auth.models import User
from django.core.management import BaseCommand
from django.utils.formats import date_format
from django.utils.translation import activate
from participation.models import Solution, Tournament
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",
]
class Command(BaseCommand):
@ -31,17 +41,6 @@ class Command(BaseCommand):
if not base_dir.is_dir():
base_dir.mkdir()
PROBLEMS = [
"Agent 1234",
"Bataille rangée",
"C'est pas trop tôt !",
"Chocolaterie de haut vol",
"Stratégies féodales",
"Le facteur n'est pas passé",
"Vive les grenouilles libres !",
"Télé truquée",
]
for problem_id, problem_name in enumerate(PROBLEMS):
dir_name = f"Problème n°{problem_id + 1} : {problem_name}"
problem_dir = base_dir / dir_name

View File

@ -534,6 +534,9 @@ class Tweak(models.Model):
help_text=_("Score to add/remove on the final score"),
)
def __str__(self):
return f"Tweak for {self.participation.team} of {self.diff} points"
class Meta:
verbose_name = _("tweak")
verbose_name_plural = _("tweaks")

View File

@ -19,7 +19,6 @@ from django.urls import reverse_lazy
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.views.generic import CreateView, DetailView, FormView, RedirectView, TemplateView, UpdateView, View
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.edit import FormMixin, ProcessFormView
from django_tables2 import SingleTableView
from magic import Magic

View File

@ -58,4 +58,4 @@ max-complexity = 10
max-line-length = 160
import-order-style = google
application-import-names = flake8
format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s
#format = ${cyan}%(path)s${reset}:${yellow_bold}%(row)d${reset}:${green_bold}%(col)d${reset}: ${red_bold}%(code)s${reset} %(text)s