mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-09-11 13:46:10 -05:00
Prevent creation of tournaments without tiebreaker map pool if required by the format selected
This commit is contained in:
@@ -324,4 +324,22 @@ export const newCalendarEventActionSchema = z
|
||||
{
|
||||
message: "Tournament must have exactly one date",
|
||||
},
|
||||
)
|
||||
.refine(
|
||||
(schema) => {
|
||||
if (schema.toToolsMode !== "ALL") {
|
||||
return true;
|
||||
}
|
||||
|
||||
const maps = schema.pool ? MapPool.toDbList(schema.pool) : [];
|
||||
|
||||
return (
|
||||
maps.length === 4 &&
|
||||
rankedModesShort.every((mode) => maps.some((map) => map.mode === mode))
|
||||
);
|
||||
},
|
||||
{
|
||||
message:
|
||||
'Map pool must contain a map for each ranked mode if using "Prepicked by teams - All modes"',
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user