tods-competition-factory 1.9.2 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/forge/generate.mjs +21 -9
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/index.mjs +180 -168
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +264 -258
- package/dist/tods-competition-factory.development.cjs.js.map +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js +1 -1
- package/dist/tods-competition-factory.production.cjs.min.js.map +1 -1
- package/package.json +2 -2
package/dist/forge/generate.mjs
CHANGED
|
@@ -12214,11 +12214,14 @@ function randomUnseededSeparation({
|
|
|
12214
12214
|
idCollections,
|
|
12215
12215
|
participants
|
|
12216
12216
|
});
|
|
12217
|
+
if (allGroups.error) {
|
|
12218
|
+
return decorateResult({ result: allGroups, stack });
|
|
12219
|
+
}
|
|
12217
12220
|
const participantIdGroups = Object.assign(
|
|
12218
12221
|
{},
|
|
12219
12222
|
...unseededParticipantIds.map((participantId) => {
|
|
12220
12223
|
const groups = Object.keys(allGroups).filter(
|
|
12221
|
-
(key) => allGroups[key].includes(participantId)
|
|
12224
|
+
(key) => (allGroups[key] ?? []).includes(participantId)
|
|
12222
12225
|
);
|
|
12223
12226
|
return { [participantId]: groups };
|
|
12224
12227
|
})
|
|
@@ -12416,7 +12419,7 @@ function positionUnseededParticipants({
|
|
|
12416
12419
|
drawDefinition,
|
|
12417
12420
|
event
|
|
12418
12421
|
});
|
|
12419
|
-
let avoidance =
|
|
12422
|
+
let avoidance = appliedPolicies?.[POLICY_TYPE_AVOIDANCE];
|
|
12420
12423
|
if (structure.stage === PLAY_OFF) {
|
|
12421
12424
|
const groupings = entries.reduce((groupings2, entry) => {
|
|
12422
12425
|
if (!groupings2[entry.groupingValue])
|
|
@@ -21711,8 +21714,8 @@ function addDrawDefinition(params) {
|
|
|
21711
21714
|
}
|
|
21712
21715
|
|
|
21713
21716
|
function attachPolicies({
|
|
21714
|
-
|
|
21715
|
-
|
|
21717
|
+
policyDefinitions,
|
|
21718
|
+
drawDefinition
|
|
21716
21719
|
}) {
|
|
21717
21720
|
if (!drawDefinition) {
|
|
21718
21721
|
return { error: MISSING_DRAW_DEFINITION };
|
|
@@ -23677,7 +23680,7 @@ function getScaleValue({
|
|
|
23677
23680
|
return scaleAccessor && isObject(scaleValue) ? scaleValue[scaleAccessor] : scaleValue;
|
|
23678
23681
|
}
|
|
23679
23682
|
|
|
23680
|
-
const
|
|
23683
|
+
const POLICY_SEEDING_DEFAULT = {
|
|
23681
23684
|
[POLICY_TYPE_SEEDING]: {
|
|
23682
23685
|
validSeedPositions: { ignore: true },
|
|
23683
23686
|
duplicateSeedNumbers: true,
|
|
@@ -23734,13 +23737,15 @@ function generateDrawDefinition(params) {
|
|
|
23734
23737
|
if (params.seedingProfile) {
|
|
23735
23738
|
if (!policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
23736
23739
|
policyDefinitions[POLICY_TYPE_SEEDING] = {
|
|
23737
|
-
...
|
|
23740
|
+
...POLICY_SEEDING_DEFAULT[POLICY_TYPE_SEEDING]
|
|
23738
23741
|
};
|
|
23739
23742
|
}
|
|
23740
23743
|
policyDefinitions[POLICY_TYPE_SEEDING].seedingProfile = seedingProfile;
|
|
23741
23744
|
}
|
|
23742
23745
|
const { participants, participantMap } = getParticipants({
|
|
23743
23746
|
withIndividualParticipants: true,
|
|
23747
|
+
convertExtensions: true,
|
|
23748
|
+
internalUse: true,
|
|
23744
23749
|
tournamentRecord
|
|
23745
23750
|
});
|
|
23746
23751
|
const enforceGender = params.enforceGender ?? policyDefinitions?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender ?? appliedPolicies?.[POLICY_TYPE_MATCHUP_ACTIONS]?.participants?.enforceGender;
|
|
@@ -23851,6 +23856,9 @@ function generateDrawDefinition(params) {
|
|
|
23851
23856
|
drawDefinition.matchUpType = matchUpType;
|
|
23852
23857
|
}
|
|
23853
23858
|
}
|
|
23859
|
+
const policiesToAttach = {
|
|
23860
|
+
[POLICY_TYPE_AVOIDANCE]: appliedPolicies[POLICY_TYPE_AVOIDANCE]
|
|
23861
|
+
};
|
|
23854
23862
|
if (policyDefinitions) {
|
|
23855
23863
|
if (typeof policyDefinitions !== "object") {
|
|
23856
23864
|
return decorateResult({
|
|
@@ -23859,7 +23867,6 @@ function generateDrawDefinition(params) {
|
|
|
23859
23867
|
stack
|
|
23860
23868
|
});
|
|
23861
23869
|
} else {
|
|
23862
|
-
const policiesToAttach = {};
|
|
23863
23870
|
for (const key of Object.keys(policyDefinitions)) {
|
|
23864
23871
|
if (JSON.stringify(appliedPolicies?.[key]) !== JSON.stringify(policyDefinitions[key])) {
|
|
23865
23872
|
policiesToAttach[key] = policyDefinitions[key];
|
|
@@ -23870,10 +23877,15 @@ function generateDrawDefinition(params) {
|
|
|
23870
23877
|
Object.assign(appliedPolicies, policiesToAttach);
|
|
23871
23878
|
}
|
|
23872
23879
|
}
|
|
23880
|
+
} else if (policiesToAttach.avoidance) {
|
|
23881
|
+
attachPolicies({ drawDefinition, policyDefinitions: policiesToAttach });
|
|
23873
23882
|
}
|
|
23874
23883
|
if (!appliedPolicies[POLICY_TYPE_SEEDING] && !policyDefinitions[POLICY_TYPE_SEEDING]) {
|
|
23875
|
-
attachPolicies({
|
|
23876
|
-
|
|
23884
|
+
attachPolicies({
|
|
23885
|
+
drawDefinition,
|
|
23886
|
+
policyDefinitions: POLICY_SEEDING_DEFAULT
|
|
23887
|
+
});
|
|
23888
|
+
Object.assign(appliedPolicies, POLICY_SEEDING_DEFAULT);
|
|
23877
23889
|
}
|
|
23878
23890
|
let structureId = existingDrawDefinition?.structures?.find(
|
|
23879
23891
|
(structure) => structure.stage === MAIN && structure.stageSequence === 1
|