Étape 9 : suppression du statut d'affectation (plus de confirmation)
Une affectation est valide dès sa création ; la retirer = supprimer la ligne.
- Modèle : suppression de AssignmentStatus, ACTIVE_ASSIGNMENT_STATUSES et de
Assignment.status ; migration 0003 (drop_column, alembic check vert)
- Loader de validation : toutes les affectations du bénévole comptent, plus de
filtre par statut
- API : AssignmentCreate/Update/Read sans status ; création → validation
toujours exécutée (blocage si violation bloquante) ; PATCH ne porte plus que
source/locked
- Matrice : MatrixShift.{confirmed, proposed} → {assigned} (compte unique)
- Seed : affectations sans statut, résumé « Affectations » (260)
- Tests mis à jour (matrice, loader, modèle, API) ; 128 tests au total
- CLAUDE.md : glossaire, modèle, sémantique de validation, périmètre
Frontend : les références au statut (propositions, badges confirmé/proposé,
écran de confirmation mobile, mock, schema.ts) restent à retirer séparément.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017uUsRg7XzopkCPWimwg9ZM
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
8a879ca5c3
commit
464635656a
@@ -35,8 +35,8 @@ def test_create_assignment_clean(client, edition, session, day_parts):
|
||||
assert resp.status_code == 201
|
||||
body = resp.json()
|
||||
assert body["warnings"] == []
|
||||
assert body["assignment"]["status"] == "PROPOSED"
|
||||
assert body["assignment"]["source"] == "MANUAL"
|
||||
assert body["assignment"]["locked"] is False
|
||||
|
||||
|
||||
def test_create_assignment_returns_warnings(client, edition, session, day_parts):
|
||||
@@ -135,7 +135,7 @@ def test_validate_endpoint_does_not_persist(client, edition, session, day_parts)
|
||||
assert client.get(_url(edition)).json() == []
|
||||
|
||||
|
||||
def test_update_status_revalidates_and_returns_warnings(
|
||||
def test_patch_locked_keeps_assignment_and_returns_warnings(
|
||||
client, edition, session, day_parts
|
||||
):
|
||||
volunteer, shift = _setup(session, edition, day_parts, available=False)
|
||||
@@ -144,47 +144,14 @@ def test_update_status_revalidates_and_returns_warnings(
|
||||
json={"volunteer_id": str(volunteer.id), "shift_id": str(shift.id)},
|
||||
).json()["assignment"]["id"]
|
||||
|
||||
resp = client.patch(
|
||||
_url(edition, f"/{aid}"), json={"status": "CONFIRMED"}
|
||||
)
|
||||
resp = client.patch(_url(edition, f"/{aid}"), json={"locked": True})
|
||||
assert resp.status_code == 200
|
||||
assert resp.json()["assignment"]["status"] == "CONFIRMED"
|
||||
assert resp.json()["assignment"]["locked"] is True
|
||||
assert any(
|
||||
w["code"] == "OUTSIDE_AVAILABILITY" for w in resp.json()["warnings"]
|
||||
)
|
||||
|
||||
|
||||
def test_cancelling_an_assignment_skips_validation(
|
||||
client, edition, session, day_parts
|
||||
):
|
||||
volunteer, shift = _setup(session, edition, day_parts)
|
||||
first = client.post(
|
||||
_url(edition),
|
||||
json={"volunteer_id": str(volunteer.id), "shift_id": str(shift.id)},
|
||||
).json()["assignment"]["id"]
|
||||
|
||||
# Un second créneau qui chevauche, mais l'affectation est directement DECLINEE.
|
||||
position = make_position(session, edition, name="X")
|
||||
overlapping = make_shift(
|
||||
session, edition, position, start=dt_at(10, 16), end=dt_at(10, 20)
|
||||
)
|
||||
created = client.post(
|
||||
_url(edition),
|
||||
json={
|
||||
"volunteer_id": str(volunteer.id),
|
||||
"shift_id": str(overlapping.id),
|
||||
"status": "DECLINED",
|
||||
},
|
||||
)
|
||||
assert created.status_code == 201
|
||||
|
||||
patched = client.patch(
|
||||
_url(edition, f"/{first}"), json={"locked": True}
|
||||
)
|
||||
assert patched.status_code == 200
|
||||
assert patched.json()["assignment"]["locked"] is True
|
||||
|
||||
|
||||
def test_delete_assignment(client, edition, session, day_parts):
|
||||
volunteer, shift = _setup(session, edition, day_parts)
|
||||
aid = client.post(
|
||||
|
||||
Reference in New Issue
Block a user