Bénévole : retrait de la taille de t-shirt et du régime alimentaire

Champs `tshirt_size` et `diet` supprimés du modèle `Volunteer`, des schémas
d'API, de l'import CSV/Excel (mapping, suggestions, exécution) et du jeu de
démonstration. Énum `TshirtSize` et helper `parse_tshirt_size` supprimés.
Migration 0005. Clé i18n `import.row.invalid_tshirt_size` retirée.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uUsRg7XzopkCPWimwg9ZM
This commit is contained in:
AdamThomas
2026-09-10 22:07:00 +02:00
co-authored by Claude Sonnet 5
parent ccf3438eef
commit 609514369a
14 changed files with 46 additions and 113 deletions
-2
View File
@@ -19,8 +19,6 @@ class ColumnMapping(BaseModel):
last_name: str
email: str | None = None
phone: str | None = None
tshirt_size: str | None = None
diet: str | None = None
comment: str | None = None
skills: str | None = None
+2 -21
View File
@@ -12,7 +12,7 @@ from app.importing.schemas import (
RowReport,
)
from app.importing.text import normalize, slug_code, split_skills
from app.importing.values import parse_availability_cell, parse_tshirt_size
from app.importing.values import parse_availability_cell
from app.models import (
Availability,
DayPart,
@@ -29,8 +29,6 @@ _FIELD_HINTS: dict[str, tuple[str, ...]] = {
"first_name": ("prenom", "first name", "firstname", "given name"),
"last_name": ("nom", "last name", "lastname", "surname", "famille"),
"phone": ("tel", "phone", "portable", "mobile", "gsm"),
"tshirt_size": ("tshirt", "t shirt", "taille", "shirt"),
"diet": ("regime", "alimentaire", "diet", "allergie"),
"comment": ("commentaire", "remarque", "note", "precision"),
"skills": ("competence", "skill", "habilitation", "brevet", "diplome"),
}
@@ -82,7 +80,7 @@ def validate_mapping(
)
)
for field in ("email", "phone", "tshirt_size", "diet", "comment", "skills"):
for field in ("email", "phone", "comment", "skills"):
header = getattr(columns, field)
if header and header not in headers:
errors.append(
@@ -281,25 +279,8 @@ def run_import(
volunteer.email = email_raw or None
if columns.phone:
volunteer.phone = (row.get(columns.phone) or "").strip() or None
if columns.diet:
volunteer.diet = (row.get(columns.diet) or "").strip() or None
if columns.comment:
volunteer.comment = (row.get(columns.comment) or "").strip() or None
if columns.tshirt_size:
raw_size = (row.get(columns.tshirt_size) or "").strip()
if raw_size:
size = parse_tshirt_size(raw_size)
if size is None:
entry.issues.append(
Issue(
code="import.row.invalid_tshirt_size",
severity="WARNING",
field="tshirt_size",
params={"value": raw_size},
)
)
else:
volunteer.tshirt_size = size
session.flush()
+2 -19
View File
@@ -1,7 +1,7 @@
"""Interprétation des valeurs de cellule : disponibilités et tailles de t-shirt."""
"""Interprétation des valeurs de cellule : disponibilités."""
from app.importing.text import normalize
from app.models import AvailabilityStatus, TshirtSize
from app.models import AvailabilityStatus
_AVAILABLE = {
"x", "o", "oui", "y", "yes", "ok", "1", "vrai", "true",
@@ -19,18 +19,6 @@ _UNAVAILABLE = {
}
_EMPTY = {"", "na", "n/a", "nc"}
_TSHIRT = {
"XS": TshirtSize.XS,
"S": TshirtSize.S,
"M": TshirtSize.M,
"L": TshirtSize.L,
"XL": TshirtSize.XL,
"XXL": TshirtSize.XXL,
"2XL": TshirtSize.XXL,
"XXXL": TshirtSize.XXXL,
"3XL": TshirtSize.XXXL,
}
def parse_availability_cell(value: str) -> tuple[AvailabilityStatus | None, bool]:
"""(statut, reconnu).
@@ -48,8 +36,3 @@ def parse_availability_cell(value: str) -> tuple[AvailabilityStatus | None, bool
if norm in _UNAVAILABLE:
return AvailabilityStatus.UNAVAILABLE, True
return None, False
def parse_tshirt_size(value: str) -> TshirtSize | None:
key = normalize(value).upper().replace(" ", "").replace("-", "")
return _TSHIRT.get(key)