tods-competition-factory 1.6.10 → 1.6.11
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 +145 -136
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.mjs +5 -2
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +5 -2
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/index.mjs +32 -24
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +53 -50
- 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 +3 -3
package/dist/index.mjs
CHANGED
|
@@ -329,7 +329,7 @@ const matchUpFormatCode = {
|
|
|
329
329
|
};
|
|
330
330
|
|
|
331
331
|
function factoryVersion() {
|
|
332
|
-
return "1.6.
|
|
332
|
+
return "1.6.11";
|
|
333
333
|
}
|
|
334
334
|
|
|
335
335
|
function getObjectTieFormat(obj) {
|
|
@@ -6452,7 +6452,7 @@ function structureSort(a, b, config) {
|
|
|
6452
6452
|
const completedStructure = (s) => s?.matchUps.every(
|
|
6453
6453
|
({ matchUpStatus }) => completedMatchUpStatuses.includes(matchUpStatus) ? 1 : -1
|
|
6454
6454
|
);
|
|
6455
|
-
return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length
|
|
6455
|
+
return completed && completedStructure(a) - completedStructure(b) || aggregate && protocolSequence(a) - protocolSequence(b) || (a?.stage && orderProtocol[a.stage] || 0) - (b?.stage && orderProtocol[b.stage] || 0) || (getRoundTarget(a) || 0) - (getRoundTarget(b) || 0) || !finish && !aggregate && (b?.positionAssignments?.length ?? Infinity) - (a?.positionAssignments?.length ?? Infinity) || (a?.stageSequence ?? 0) - (b?.stageSequence ?? 0) || (getMinFinishingPositionRange(a) || 0) - (getMinFinishingPositionRange(b) || 0);
|
|
6456
6456
|
}
|
|
6457
6457
|
function getMinFinishingPositionRange(structure) {
|
|
6458
6458
|
return (structure?.matchUps || []).reduce((rangeSum, matchUp) => {
|
|
@@ -6641,6 +6641,7 @@ function getStageEntryTypeCount({ stage, drawDefinition, entryStatus }) {
|
|
|
6641
6641
|
}
|
|
6642
6642
|
function getStageEntries$1({
|
|
6643
6643
|
provisionalPositioning,
|
|
6644
|
+
placementGroup,
|
|
6644
6645
|
drawDefinition,
|
|
6645
6646
|
stageSequence,
|
|
6646
6647
|
entryStatuses,
|
|
@@ -6670,7 +6671,9 @@ function getStageEntries$1({
|
|
|
6670
6671
|
if (error) {
|
|
6671
6672
|
console.log("playoff entries error");
|
|
6672
6673
|
}
|
|
6673
|
-
return playoffEntries?.length ? playoffEntries : entries
|
|
6674
|
+
return (playoffEntries?.length ? playoffEntries : entries).filter(
|
|
6675
|
+
(entry) => !placementGroup || entry.placementGroup === placementGroup
|
|
6676
|
+
);
|
|
6674
6677
|
}
|
|
6675
6678
|
return entries;
|
|
6676
6679
|
}
|
|
@@ -14603,7 +14606,7 @@ const POLICY_SCHEDULING_USTA = {
|
|
|
14603
14606
|
},
|
|
14604
14607
|
matchUpAverageTimes: [
|
|
14605
14608
|
{
|
|
14606
|
-
matchUpFormatCodes: [
|
|
14609
|
+
matchUpFormatCodes: [FORMAT_STANDARD],
|
|
14607
14610
|
// Best of 3 tiebreak sets
|
|
14608
14611
|
averageTimes: [
|
|
14609
14612
|
{
|
|
@@ -14790,11 +14793,11 @@ const POLICY_SCORING_USTA = {
|
|
|
14790
14793
|
}
|
|
14791
14794
|
}
|
|
14792
14795
|
},
|
|
14793
|
-
defaultMatchUpFormat:
|
|
14796
|
+
defaultMatchUpFormat: FORMAT_STANDARD,
|
|
14794
14797
|
matchUpFormats: [
|
|
14795
14798
|
{
|
|
14796
14799
|
description: "Best of 3 tiebreak sets",
|
|
14797
|
-
matchUpFormat:
|
|
14800
|
+
matchUpFormat: FORMAT_STANDARD,
|
|
14798
14801
|
categoryNames: [],
|
|
14799
14802
|
categoryTypes: []
|
|
14800
14803
|
},
|
|
@@ -14876,7 +14879,7 @@ const POLICY_SCORING_USTA = {
|
|
|
14876
14879
|
|
|
14877
14880
|
const POLICY_SCORING_DEFAULT = {
|
|
14878
14881
|
[POLICY_TYPE_SCORING]: {
|
|
14879
|
-
defaultMatchUpFormat:
|
|
14882
|
+
defaultMatchUpFormat: FORMAT_STANDARD,
|
|
14880
14883
|
requireAllPositionsAssigned: false,
|
|
14881
14884
|
processCodes: {
|
|
14882
14885
|
incompleteAssignmentsOnDefault: ["RANKING.IGNORE"]
|
|
@@ -38113,10 +38116,10 @@ function processPlayoffGroups({
|
|
|
38113
38116
|
finishingPositionOffset = Math.min(...positionsPlayedOff) - 1;
|
|
38114
38117
|
}
|
|
38115
38118
|
const params = {
|
|
38119
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
38116
38120
|
structureName: playoffGroup.structureName,
|
|
38117
38121
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
38118
38122
|
appliedPolicies: policyDefinitions,
|
|
38119
|
-
structureId: uuids?.pop(),
|
|
38120
38123
|
finishingPositionOffset,
|
|
38121
38124
|
stage: PLAY_OFF,
|
|
38122
38125
|
stageSequence,
|
|
@@ -38152,9 +38155,9 @@ function processPlayoffGroups({
|
|
|
38152
38155
|
uuids
|
|
38153
38156
|
});
|
|
38154
38157
|
const playoffStructure = structureTemplate({
|
|
38158
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
38155
38159
|
structureName: playoffGroup.structureName,
|
|
38156
38160
|
matchUpFormat: playoffMatchUpFormat,
|
|
38157
|
-
structureId: uuids?.pop(),
|
|
38158
38161
|
stage: PLAY_OFF,
|
|
38159
38162
|
stageSequence,
|
|
38160
38163
|
matchUps
|
|
@@ -38174,6 +38177,7 @@ function processPlayoffGroups({
|
|
|
38174
38177
|
} else if ([COMPASS, OLYMPIC, PLAY_OFF].includes(playoffDrawType)) {
|
|
38175
38178
|
const { structureName } = playoffGroup;
|
|
38176
38179
|
const params2 = {
|
|
38180
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
38177
38181
|
playoffStructureNameBase: structureName,
|
|
38178
38182
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
38179
38183
|
addNameBaseToAttributeName: true,
|
|
@@ -38227,6 +38231,7 @@ function processPlayoffGroups({
|
|
|
38227
38231
|
].includes(playoffDrawType)) {
|
|
38228
38232
|
const uuidsFMLC = [uuids?.pop(), uuids?.pop()];
|
|
38229
38233
|
const params2 = {
|
|
38234
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
38230
38235
|
structureName: playoffGroup.structureName,
|
|
38231
38236
|
idPrefix: idPrefix && `${idPrefix}-po`,
|
|
38232
38237
|
finishingPositionOffset,
|
|
@@ -38274,9 +38279,9 @@ function processPlayoffGroups({
|
|
|
38274
38279
|
updateStructureAndLinks({ playoffStructures, playoffLinks });
|
|
38275
38280
|
} else if ([AD_HOC].includes(playoffDrawType)) {
|
|
38276
38281
|
const structure = structureTemplate({
|
|
38282
|
+
structureId: playoffGroup.structureId ?? uuids?.pop(),
|
|
38277
38283
|
structureName: playoffGroup.structureName,
|
|
38278
38284
|
finishingPosition: WIN_RATIO$1,
|
|
38279
|
-
structureId: uuids?.pop(),
|
|
38280
38285
|
stage: PLAY_OFF,
|
|
38281
38286
|
stageSequence,
|
|
38282
38287
|
matchUps: []
|
|
@@ -40823,6 +40828,7 @@ function automatedPositioning$1({
|
|
|
40823
40828
|
placeByes = true,
|
|
40824
40829
|
tournamentRecord,
|
|
40825
40830
|
appliedPolicies,
|
|
40831
|
+
placementGroup,
|
|
40826
40832
|
drawDefinition,
|
|
40827
40833
|
seedingProfile,
|
|
40828
40834
|
participants,
|
|
@@ -40874,6 +40880,7 @@ function automatedPositioning$1({
|
|
|
40874
40880
|
stageSequence: structure.stageSequence,
|
|
40875
40881
|
provisionalPositioning,
|
|
40876
40882
|
stage: structure.stage,
|
|
40883
|
+
placementGroup,
|
|
40877
40884
|
drawDefinition,
|
|
40878
40885
|
entryStatuses,
|
|
40879
40886
|
structureId
|
|
@@ -41089,10 +41096,12 @@ function automatedPlayoffPositioning(params) {
|
|
|
41089
41096
|
if (!structureIsComplete && !provisionalPositioning) {
|
|
41090
41097
|
return { error: INCOMPLETE_SOURCE_STRUCTURE };
|
|
41091
41098
|
}
|
|
41092
|
-
const
|
|
41099
|
+
const playoffStructures = getPlayoffStructures({
|
|
41093
41100
|
drawDefinition,
|
|
41094
41101
|
structureId
|
|
41095
|
-
})
|
|
41102
|
+
}).playoffStructures?.sort(
|
|
41103
|
+
(a, b) => getMinFinishingPositionRange(a) - getMinFinishingPositionRange(b)
|
|
41104
|
+
);
|
|
41096
41105
|
const structurePositionAssignments = [];
|
|
41097
41106
|
const participants = tournamentRecord?.participants;
|
|
41098
41107
|
if (playoffStructures) {
|
|
@@ -41237,9 +41246,9 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
41237
41246
|
structureId: sourceStructureId,
|
|
41238
41247
|
addNameBaseToAttributeName,
|
|
41239
41248
|
playoffStructureNameBase,
|
|
41240
|
-
tournamentRecord,
|
|
41241
41249
|
playoffAttributes,
|
|
41242
41250
|
playoffPositions,
|
|
41251
|
+
tournamentRecord,
|
|
41243
41252
|
exitProfileLimit,
|
|
41244
41253
|
roundProfiles,
|
|
41245
41254
|
roundNumbers,
|
|
@@ -41314,7 +41323,7 @@ function generateAndPopulatePlayoffStructures(params) {
|
|
|
41314
41323
|
const roundsRanges = validRoundNumbers ? availablePlayoffRoundsRanges : playoffRoundsRanges;
|
|
41315
41324
|
const newStructures = [];
|
|
41316
41325
|
const newLinks = [];
|
|
41317
|
-
for (const roundNumber of sourceRounds
|
|
41326
|
+
for (const roundNumber of sourceRounds ?? []) {
|
|
41318
41327
|
const roundInfo = roundsRanges?.find(
|
|
41319
41328
|
(roundInfo2) => roundInfo2.roundNumber === roundNumber
|
|
41320
41329
|
);
|
|
@@ -54031,7 +54040,6 @@ const tieFormatConstants = {
|
|
|
54031
54040
|
USTA_ZONAL
|
|
54032
54041
|
};
|
|
54033
54042
|
|
|
54034
|
-
const bestOf3tbSets = "SET3-S:6/TB7";
|
|
54035
54043
|
const STANDARD = "STANDARD";
|
|
54036
54044
|
const namedFormats = {
|
|
54037
54045
|
[STANDARD]: {
|
|
@@ -54048,9 +54056,9 @@ const namedFormats = {
|
|
|
54048
54056
|
matchUpFormat: "SET1-S:8/TB7@7"
|
|
54049
54057
|
},
|
|
54050
54058
|
singles: {
|
|
54059
|
+
matchUpFormat: FORMAT_STANDARD,
|
|
54051
54060
|
matchUpCount: 6,
|
|
54052
|
-
matchUpValue: 1
|
|
54053
|
-
matchUpFormat: bestOf3tbSets
|
|
54061
|
+
matchUpValue: 1
|
|
54054
54062
|
},
|
|
54055
54063
|
tieFormatName: COLLEGE_D3,
|
|
54056
54064
|
valueGoal: 5
|
|
@@ -54060,12 +54068,12 @@ const namedFormats = {
|
|
|
54060
54068
|
doubles: {
|
|
54061
54069
|
matchUpCount: 3,
|
|
54062
54070
|
collectionValue: 1,
|
|
54063
|
-
matchUpFormat:
|
|
54071
|
+
matchUpFormat: FORMAT_STANDARD
|
|
54064
54072
|
},
|
|
54065
54073
|
singles: {
|
|
54066
54074
|
matchUpCount: 6,
|
|
54067
54075
|
matchUpValue: 1,
|
|
54068
|
-
matchUpFormat:
|
|
54076
|
+
matchUpFormat: FORMAT_STANDARD
|
|
54069
54077
|
},
|
|
54070
54078
|
tieFormatName: COLLEGE_DEFAULT,
|
|
54071
54079
|
valueGoal: 4
|
|
@@ -54080,7 +54088,7 @@ const namedFormats = {
|
|
|
54080
54088
|
singles: {
|
|
54081
54089
|
matchUpCount: 6,
|
|
54082
54090
|
matchUpValue: 1,
|
|
54083
|
-
matchUpFormat:
|
|
54091
|
+
matchUpFormat: FORMAT_STANDARD
|
|
54084
54092
|
},
|
|
54085
54093
|
tieFormatName: COLLEGE_JUCO,
|
|
54086
54094
|
valueGoal: 5
|
|
@@ -54120,7 +54128,7 @@ const tieFormatDefaults = (params) => {
|
|
|
54120
54128
|
collectionDefinitions: [
|
|
54121
54129
|
{
|
|
54122
54130
|
collectionId: uuids?.pop() || UUID(),
|
|
54123
|
-
matchUpFormat:
|
|
54131
|
+
matchUpFormat: FORMAT_ATP_DOUBLES,
|
|
54124
54132
|
matchUpType: TypeEnum.Doubles,
|
|
54125
54133
|
collectionName: "Doubles",
|
|
54126
54134
|
...template.doubles
|
|
@@ -54128,7 +54136,7 @@ const tieFormatDefaults = (params) => {
|
|
|
54128
54136
|
{
|
|
54129
54137
|
collectionId: uuids?.pop() || UUID(),
|
|
54130
54138
|
matchUpType: TypeEnum.Singles,
|
|
54131
|
-
matchUpFormat:
|
|
54139
|
+
matchUpFormat: FORMAT_STANDARD,
|
|
54132
54140
|
collectionName: "Singles",
|
|
54133
54141
|
...template.singles
|
|
54134
54142
|
}
|
|
@@ -56657,7 +56665,7 @@ function generateDrawDefinition(params) {
|
|
|
56657
56665
|
} else if (!matchUpFormat) {
|
|
56658
56666
|
tieFormat = void 0;
|
|
56659
56667
|
if (!event?.matchUpFormat) {
|
|
56660
|
-
matchUpFormat =
|
|
56668
|
+
matchUpFormat = FORMAT_STANDARD;
|
|
56661
56669
|
}
|
|
56662
56670
|
}
|
|
56663
56671
|
const invalidDrawId = params.drawId && typeof params.drawId !== "string";
|
|
@@ -60038,9 +60046,9 @@ const defaultStatusProfile = {
|
|
|
60038
60046
|
function generateOutcome(params) {
|
|
60039
60047
|
let { defaultWithScorePercent = 2, winningSide } = params;
|
|
60040
60048
|
const {
|
|
60041
|
-
matchUpFormat = "SET3-S:6/TB7",
|
|
60042
60049
|
matchUpStatusProfile = defaultStatusProfile,
|
|
60043
60050
|
// { matchUpStatusProfile: {} } will always return only { matchUpStatus: COMPLETED }
|
|
60051
|
+
matchUpFormat = FORMAT_STANDARD,
|
|
60044
60052
|
pointsPerMinute = 1,
|
|
60045
60053
|
sideWeight = 4
|
|
60046
60054
|
} = params;
|