claude/admiring-bohr-2zvef9 #149

Merged
chrisp merged 2 commits from claude/admiring-bohr-2zvef9 into main 2026-09-11 19:34:34 +00:00
2 changed files with 27 additions and 2 deletions
Showing only changes of commit caff5093ae - Show all commits

View file

@ -87,6 +87,20 @@ describe("reseed-afl-semifinals", () => {
}); });
}); });
it("reports a slot that was emptied without being refilled", async () => {
// Un-recording an Elimination Final result takes its winner back out of the semi.
vi.mocked(reseedAflSemiFinals).mockResolvedValue({
vacated: [1, 2],
filled: [{ matchNumber: 2, participantId: "adelaide" }],
});
expect(await run()).toEqual({
success:
"Re-seeded the Semi-Finals: match 1 is back to TBD, " +
"match 2 now hosts Adelaide Crows.",
});
});
it("says so when the pairings are already right", async () => { it("says so when the pairings are already right", async () => {
vi.mocked(reseedAflSemiFinals).mockResolvedValue({ vacated: [], filled: [] }); vi.mocked(reseedAflSemiFinals).mockResolvedValue({ vacated: [], filled: [] });

View file

@ -935,9 +935,20 @@ export async function action({ request, params }: Route.ActionArgs) {
// Only the qualifier slots move, so there is nothing to re-score: no placement, // Only the qualifier slots move, so there is nothing to re-score: no placement,
// score or elimination changes, and so nothing to announce. // score or elimination changes, and so nothing to announce.
const moves = reseed.filled //
// A slot can be vacated without being refilled — un-recording an Elimination Final
// result takes its winner back out — so report those too rather than rendering an
// empty list.
const filled = reseed.filled.map((slot) => ({
matchNumber: slot.matchNumber,
text: `match ${slot.matchNumber} now hosts ${nameOf(slot.participantId)}`,
}));
const emptied = reseed.vacated
.filter((matchNumber) => !reseed.filled.some((slot) => slot.matchNumber === matchNumber))
.map((matchNumber) => ({ matchNumber, text: `match ${matchNumber} is back to TBD` }));
const moves = [...filled, ...emptied]
.toSorted((a, b) => a.matchNumber - b.matchNumber) .toSorted((a, b) => a.matchNumber - b.matchNumber)
.map((slot) => `match ${slot.matchNumber} now hosts ${nameOf(slot.participantId)}`) .map((move) => move.text)
.join(", "); .join(", ");
return { return {