Badges : corrections de lint (E501) et couverture du smoke test
Lignes trop longues détectées par ruff (badges.py, tests) ; ajout de /badges au smoke test frontend (rendu SSR de chaque écran protégé). Vérifié dans ce commit : pytest (248 passés), ruff check, alembic check, tsc --noEmit, eslint, vite build, smoke — tous verts. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
579ea5d9db
commit
bc165757ca
@@ -226,14 +226,18 @@ AssignmentRow = tuple[Position, Shift, Volunteer | None] # (poste, créneau, r
|
||||
|
||||
|
||||
def _role_label(volunteer_id: uuid.UUID, lead_volunteer_ids: set[uuid.UUID]) -> str:
|
||||
return t("badge.role.referent") if volunteer_id in lead_volunteer_ids else t("badge.role.volunteer")
|
||||
if volunteer_id in lead_volunteer_ids:
|
||||
return t("badge.role.referent")
|
||||
return t("badge.role.volunteer")
|
||||
|
||||
|
||||
def _category_label(category) -> str:
|
||||
return t(f"position.category.{category.value.lower()}")
|
||||
|
||||
|
||||
def _position_line(position: Position, shift: Shift, referent: Volunteer | None, volunteer_id: uuid.UUID) -> str:
|
||||
def _position_line(
|
||||
position: Position, shift: Shift, referent: Volunteer | None, volunteer_id: uuid.UUID
|
||||
) -> str:
|
||||
"""Une ligne par créneau affecté : poste + horaire, et le référent du
|
||||
poste s'il y en a un — sauf si le bénévole badgé est lui-même ce
|
||||
référent (pas besoin de se l'indiquer à soi-même)."""
|
||||
@@ -258,7 +262,9 @@ def _field_text(
|
||||
for position, shift, referent in assignments
|
||||
)
|
||||
if field.field_type == BadgeFieldType.CATEGORY:
|
||||
categories = sorted({_category_label(position.category) for position, _shift, _r in assignments})
|
||||
categories = sorted(
|
||||
{_category_label(position.category) for position, _shift, _r in assignments}
|
||||
)
|
||||
return ", ".join(categories)
|
||||
if field.field_type == BadgeFieldType.ROLE:
|
||||
return _role_label(volunteer.id, lead_volunteer_ids)
|
||||
@@ -315,7 +321,9 @@ def generate_badges(
|
||||
BadgeSpec(
|
||||
fields=tuple(
|
||||
BadgeFieldSpec(
|
||||
text=_field_text(field, volunteer, assignments_by_volunteer, lead_volunteer_ids),
|
||||
text=_field_text(
|
||||
field, volunteer, assignments_by_volunteer, lead_volunteer_ids
|
||||
),
|
||||
x_mm=field.x_mm,
|
||||
y_mm=field.y_mm,
|
||||
width_mm=field.width_mm,
|
||||
|
||||
Reference in New Issue
Block a user