1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-06 18:14:04 +02:00

Compare commits

..

2 Commits

Author SHA1 Message Date
7f8934a647 Drop Python 3.8 support, add Python 3.10 and 3.11 support
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2022-11-08 15:55:09 +01:00
815206a0a5 Linting
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
2022-11-08 15:52:54 +01:00
9 changed files with 90 additions and 81 deletions

View File

@ -2,14 +2,6 @@ stages:
- test
- quality-assurance
py38:
stage: test
image: python:3.8-alpine
before_script:
- apk add --no-cache libmagic
- pip install tox --no-cache-dir
script: tox -e py38
py39:
stage: test
image: python:3.9-alpine
@ -18,6 +10,22 @@ py39:
- pip install tox --no-cache-dir
script: tox -e py39
py310:
stage: test
image: python:3.10-alpine
before_script:
- apk add --no-cache libmagic
- pip install tox --no-cache-dir
script: tox -e py310
py311:
stage: test
image: python:3.11-alpine
before_script:
- apk add --no-cache libmagic
- pip install tox --no-cache-dir
script: tox -e py311
linters:
stage: quality-assurance
image: python:3-alpine

View File

@ -1,4 +1,4 @@
FROM python:3.10-alpine
FROM python:3.11-alpine
ENV PYTHONUNBUFFERED 1
ENV DJANGO_ALLOW_ASYNC_UNSAFE 1

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

@ -1,8 +1,8 @@
[tox]
envlist =
py38
py39
py310
py311
linters
skipsdist = True
@ -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