Ensure seeds don't change after tournament start Closes #2004
Some checks are pending
Tests and checks on push / run-checks-and-tests (push) Waiting to run
Updates translation progress / update-translation-progress-issue (push) Waiting to run

This commit is contained in:
Kalle
2025-01-23 19:45:46 +02:00
parent 734eb46596
commit c58000f3fd

View File

@@ -45,6 +45,7 @@ import {
tournamentBracketsSubscribePage,
tournamentJoinPage,
} from "~/utils/urls";
import { updateTeamSeeds } from "../../tournament/queries/updateTeamSeeds.server";
import {
useBracketExpanded,
useTournament,
@@ -142,6 +143,17 @@ export const action: ActionFunction = async ({ params, request }) => {
bracket,
}),
);
// ensures autoseeding is disabled
const isAllSeedsPersisted = tournament.ctx.teams.every(
(team) => typeof team.seed === "number",
);
if (!isAllSeedsPersisted) {
updateTeamSeeds({
tournamentId: tournament.ctx.id,
teamIds: tournament.ctx.teams.map((team) => team.id),
});
}
})();
break;