Deux postes en même temps possibles, malus dans le solveur
ci-cd / build-backend (push) Successful in 45s
ci-cd / build-frontend (push) Successful in 24s
ci-cd / deploy (push) Successful in 27s

Le chevauchement de créneaux (SHIFT_OVERLAP) n'est plus bloquant : il
remonte en avertissement et l'affectation est enregistrée. Le solveur ne
l'exclut plus mais applique un fort malus au bénévole déjà affecté
ailleurs au même moment (proposé seulement sous l'effectif minimal, faute
de mieux) ; il n'est jamais reproposé sur un créneau où il est déjà.
Même malus dans le classement par défaut du panneau et dans le mock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AdamThomas
2026-10-25 10:38:52 +01:00
co-authored by Claude Opus 5.5
parent d0fa1e109c
commit 0f904f5e3d
11 changed files with 114 additions and 37 deletions
+34
View File
@@ -74,6 +74,40 @@ def test_fully_staffed_shift_gets_no_suggestion():
assert solution.suggestions == ()
def test_busy_volunteer_is_still_suggested_for_an_urgent_gap_as_last_resort():
# Déjà affecté ailleurs au même moment : malus, mais seul candidat pour un
# créneau sous son minimum ⇒ proposé quand même.
shift = _shift(min_staff=1, ideal_staff=1)
busy = _volunteer(
"busy",
existing_shifts=[ShiftInfo(id="e", starts_at=_dt(10, 15), ends_at=_dt(10, 19))],
)
solution = solve(SolverInput(shifts=(shift,), volunteers=(busy,)))
assert _by_shift(solution, "s1") == ("busy",)
def test_volunteer_already_on_the_shift_is_never_suggested_again():
shift = _shift(min_staff=2, ideal_staff=2, already_assigned=1)
on_it = _volunteer(
"on_it",
existing_shifts=[ShiftInfo(id="s1", starts_at=_dt(10, 14), ends_at=_dt(10, 18))],
)
solution = solve(SolverInput(shifts=(shift,), volunteers=(on_it,)))
assert _by_shift(solution, "s1") == ()
def test_busy_volunteer_is_not_suggested_above_the_minimum():
# Minimum déjà atteint : le malus l'emporte, personne n'est proposé.
shift = _shift(min_staff=1, ideal_staff=2, already_assigned=1)
busy = _volunteer(
"busy",
wished_position_ids={"p1"},
existing_shifts=[ShiftInfo(id="e", starts_at=_dt(10, 15), ends_at=_dt(10, 19))],
)
solution = solve(SolverInput(shifts=(shift,), volunteers=(busy,)))
assert _by_shift(solution, "s1") == ()
def test_picks_the_only_free_volunteer_over_a_busy_one():
shift = _shift()
busy = _volunteer(