Check that groups are full before making a match

This commit is contained in:
Kalle
2023-08-15 00:15:30 +03:00
parent 2bc325d8e8
commit f1642d6b45

View File

@@ -204,6 +204,15 @@ export const action: ActionFunction = async ({ request }) => {
);
if (!theirGroup) return null;
validate(
ourGroup.members.length === FULL_GROUP_SIZE,
"'ourGroup' is not full"
);
validate(
theirGroup.members.length === FULL_GROUP_SIZE,
"'theirGroup' is not full"
);
const createdMatch = createMatch({
alphaGroupId: ourGroup.id,
bravoGroupId: theirGroup.id,