mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-21 18:04:39 -05:00
Fix not being able to undo score in round robin
This commit is contained in:
parent
829b0af9c0
commit
e0b6f90500
|
|
@ -26,12 +26,10 @@ export const frontPageSchema = z.union([
|
|||
}),
|
||||
z.object({
|
||||
_action: _action("ADD_FRIEND_CODE"),
|
||||
friendCode: z
|
||||
.string()
|
||||
.regex(FRIEND_CODE_REGEXP, {
|
||||
message:
|
||||
"Invalid friend code. Did you include dashes? Example: 1234-5678-9012",
|
||||
}),
|
||||
friendCode: z.string().regex(FRIEND_CODE_REGEXP, {
|
||||
message:
|
||||
"Invalid friend code. Did you include dashes? Example: 1234-5678-9012",
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,13 +24,16 @@ export class Reset extends BaseUpdater {
|
|||
stored.round_id,
|
||||
);
|
||||
const matchLocation = helpers.getMatchLocation(stage.type, group.number);
|
||||
const nextMatches = this.getNextMatches(
|
||||
stored,
|
||||
matchLocation,
|
||||
stage,
|
||||
roundNumber,
|
||||
roundCount,
|
||||
);
|
||||
const nextMatches =
|
||||
stage.type !== "round_robin"
|
||||
? this.getNextMatches(
|
||||
stored,
|
||||
matchLocation,
|
||||
stage,
|
||||
roundNumber,
|
||||
roundCount,
|
||||
)
|
||||
: [];
|
||||
|
||||
if (
|
||||
nextMatches.some(
|
||||
|
|
|
|||
|
|
@ -339,7 +339,9 @@ test.describe("Tournament bracket", () => {
|
|||
|
||||
await page.getByLabel("Action").selectOption("CHECK_IN");
|
||||
await page.getByLabel("Team").selectOption("216");
|
||||
await page.getByLabel("Bracket").selectOption("Underground bracket");
|
||||
await page
|
||||
.getByLabel("Bracket", { exact: true })
|
||||
.selectOption("Underground bracket");
|
||||
await submit(page);
|
||||
|
||||
await navigate({
|
||||
|
|
@ -391,6 +393,60 @@ test.describe("Tournament bracket", () => {
|
|||
).toHaveCount(3);
|
||||
});
|
||||
|
||||
test("reopens round robin match and changes score", async ({ page }) => {
|
||||
const tournamentId = 3;
|
||||
|
||||
await seed(page);
|
||||
await impersonate(page);
|
||||
|
||||
await navigate({
|
||||
page,
|
||||
url: tournamentBracketsPage({ tournamentId }),
|
||||
});
|
||||
|
||||
await page.getByTestId("finalize-bracket-button").click();
|
||||
|
||||
// set situation where match A is completed and its participants also completed their follow up matches B & C
|
||||
// and then we go back and change the winner of A
|
||||
await navigateToMatch(page, 8);
|
||||
await reportResult({
|
||||
page,
|
||||
amountOfMapsToReport: 2,
|
||||
sidesWithMoreThanFourPlayers: ["first"],
|
||||
points: [100, 0],
|
||||
});
|
||||
await backToBracket(page);
|
||||
|
||||
await navigateToMatch(page, 9);
|
||||
await reportResult({
|
||||
page,
|
||||
amountOfMapsToReport: 2,
|
||||
sidesWithMoreThanFourPlayers: ["last"],
|
||||
points: [100, 0],
|
||||
});
|
||||
await backToBracket(page);
|
||||
|
||||
await navigateToMatch(page, 10);
|
||||
await reportResult({
|
||||
page,
|
||||
amountOfMapsToReport: 2,
|
||||
sidesWithMoreThanFourPlayers: ["last"],
|
||||
points: [100, 0],
|
||||
});
|
||||
await backToBracket(page);
|
||||
|
||||
await navigateToMatch(page, 8);
|
||||
await page.getByTestId("reopen-match-button").click();
|
||||
await page.getByTestId("undo-score-button").click();
|
||||
await reportResult({
|
||||
page,
|
||||
amountOfMapsToReport: 2,
|
||||
sidesWithMoreThanFourPlayers: ["first"],
|
||||
points: [0, 100],
|
||||
winner: 2,
|
||||
});
|
||||
});
|
||||
|
||||
test("locks/unlocks matches & sets match as casted", async ({ page }) => {
|
||||
const tournamentId = 2;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user