mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-13 06:36:49 -05:00
Ensure seeds don't change after tournament start Closes #2004
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user