Report a Semi-Final slot that was emptied without being refilled
The re-seed banner listed only the slots that were filled, so a re-seed that just vacated one — un-recording an Elimination Final result takes its winner back out of the semi — rendered as "Re-seeded the Semi-Finals: ." with nothing after the colon. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MSDeNWAXvK7nznJqjxn7Jo
This commit is contained in:
parent
cdf86d1682
commit
caff5093ae
2 changed files with 27 additions and 2 deletions
|
|
@ -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: [] });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue