tods-competition-factory 0.86.3 → 0.88.2
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/tods-competition-factory.development.cjs.js +510 -245
- 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/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +5 -5
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.88.2';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -7628,7 +7628,7 @@ var tieFormatName$3 = "USTA_INTERSECTIONAL";
|
|
|
7628
7628
|
var winCriteria$3 = {
|
|
7629
7629
|
valueGoal: 8
|
|
7630
7630
|
};
|
|
7631
|
-
var
|
|
7631
|
+
var USTA_INTERSECTIONAL_TIE_FORMAT = {
|
|
7632
7632
|
collectionDefinitions: collectionDefinitions$3,
|
|
7633
7633
|
tieFormatName: tieFormatName$3,
|
|
7634
7634
|
winCriteria: winCriteria$3
|
|
@@ -7668,7 +7668,7 @@ var tieFormatName$2 = "USTA_LEVEL_1";
|
|
|
7668
7668
|
var winCriteria$2 = {
|
|
7669
7669
|
valueGoal: 10
|
|
7670
7670
|
};
|
|
7671
|
-
var
|
|
7671
|
+
var USTA_LEVEL_1_TIE_FORMAT = {
|
|
7672
7672
|
collectionDefinitions: collectionDefinitions$2,
|
|
7673
7673
|
tieFormatName: tieFormatName$2,
|
|
7674
7674
|
winCriteria: winCriteria$2
|
|
@@ -7701,7 +7701,7 @@ var tieFormatName$1 = "USTA_SOUTHERN_LEVEL_5";
|
|
|
7701
7701
|
var winCriteria$1 = {
|
|
7702
7702
|
valueGoal: 8
|
|
7703
7703
|
};
|
|
7704
|
-
var
|
|
7704
|
+
var USTA_SOUTHERN_LEVEL_5_TIE_FORMAT = {
|
|
7705
7705
|
collectionDefinitions: collectionDefinitions$1,
|
|
7706
7706
|
tieFormatName: tieFormatName$1,
|
|
7707
7707
|
winCriteria: winCriteria$1
|
|
@@ -7748,7 +7748,7 @@ var tieFormatName = "USTA_ZONAL";
|
|
|
7748
7748
|
var winCriteria = {
|
|
7749
7749
|
valueGoal: 10
|
|
7750
7750
|
};
|
|
7751
|
-
var
|
|
7751
|
+
var USTA_ZONAL_TIE_FORMAT = {
|
|
7752
7752
|
collectionDefinitions: collectionDefinitions,
|
|
7753
7753
|
tieFormatName: tieFormatName,
|
|
7754
7754
|
winCriteria: winCriteria
|
|
@@ -7761,10 +7761,10 @@ const tieFormats = {
|
|
|
7761
7761
|
DOMINANT_DUO: DOMINANT_DUO_TIE_FORMAT,
|
|
7762
7762
|
LAVER_CUP: LAVER_CUP_TIE_FORMAT,
|
|
7763
7763
|
TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT,
|
|
7764
|
-
USTA_INTERSECTIONAL:
|
|
7765
|
-
USTA_LEVEL_1:
|
|
7766
|
-
USTA_SOUTHERN_LEVEL_5:
|
|
7767
|
-
USTA_ZONAL:
|
|
7764
|
+
USTA_INTERSECTIONAL: USTA_INTERSECTIONAL_TIE_FORMAT,
|
|
7765
|
+
USTA_LEVEL_1: USTA_LEVEL_1_TIE_FORMAT,
|
|
7766
|
+
USTA_SOUTHERN_LEVEL_5: USTA_SOUTHERN_LEVEL_5_TIE_FORMAT,
|
|
7767
|
+
USTA_ZONAL: USTA_ZONAL_TIE_FORMAT
|
|
7768
7768
|
};
|
|
7769
7769
|
|
|
7770
7770
|
const POLICY_AVOIDANCE_COUNTRY = {
|
|
@@ -9909,26 +9909,29 @@ function getRoundMatchUps$1({
|
|
|
9909
9909
|
roundProfile[roundNumber].drawPositions = orderedDrawPositions;
|
|
9910
9910
|
roundProfile[roundNumber].pairedDrawPositions = pairedDrawPositions;
|
|
9911
9911
|
} else {
|
|
9912
|
-
const
|
|
9913
|
-
const
|
|
9912
|
+
const priorRound = roundProfile[roundNumber - 1];
|
|
9913
|
+
const priorRoundDrawPositions = priorRound.drawPositions;
|
|
9914
|
+
const chunkFactor = priorRound.matchUpsCount / roundProfile[roundNumber].matchUpsCount;
|
|
9914
9915
|
const priorRoundDrawPositionChunks = chunkArray(priorRoundDrawPositions, chunkFactor); // ensures that drawPositions are returned in top to bottom order
|
|
9915
9916
|
|
|
9916
9917
|
const roundDrawPositions = currentRoundMatchUps.map(matchUp => {
|
|
9917
9918
|
const {
|
|
9918
|
-
roundPosition
|
|
9919
|
-
drawPositions
|
|
9919
|
+
roundPosition
|
|
9920
9920
|
} = matchUp;
|
|
9921
|
+
const drawPositions = [].concat(...(matchUp.drawPositions || []), undefined, undefined).slice(0, 2); // accounts for empty array, should always have length 2
|
|
9922
|
+
|
|
9921
9923
|
if (!roundPosition) return drawPositions;
|
|
9922
9924
|
const filteredDrawPositions = (drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.filter(Boolean)) || [];
|
|
9923
9925
|
if (!(filteredDrawPositions !== null && filteredDrawPositions !== void 0 && filteredDrawPositions.length)) return [undefined, undefined]; // { roundNumber: 2 } is the first possible feed round and the last time that a numeric sort is guaranteed to work
|
|
9924
9926
|
|
|
9925
9927
|
if (roundNumber < 3 && (filteredDrawPositions === null || filteredDrawPositions === void 0 ? void 0 : filteredDrawPositions.length) === 2) {
|
|
9926
9928
|
return drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.slice().sort(numericSort);
|
|
9927
|
-
}
|
|
9928
|
-
// ... and fed positions are always { sideNumber: 1 }
|
|
9929
|
+
}
|
|
9929
9930
|
|
|
9931
|
+
const isFeedRound = intersection(priorRoundDrawPositions, filteredDrawPositions).length !== (filteredDrawPositions === null || filteredDrawPositions === void 0 ? void 0 : filteredDrawPositions.length); // if the prior round does NOT include the one existing drawPosition then it is a feed round
|
|
9932
|
+
// ... and fed positions are always { sideNumber: 1 }
|
|
9930
9933
|
|
|
9931
|
-
if (filteredDrawPositions !== null && filteredDrawPositions !== void 0 && filteredDrawPositions.length &&
|
|
9934
|
+
if (filteredDrawPositions !== null && filteredDrawPositions !== void 0 && filteredDrawPositions.length && isFeedRound) {
|
|
9932
9935
|
if ((filteredDrawPositions === null || filteredDrawPositions === void 0 ? void 0 : filteredDrawPositions.length) === 1) {
|
|
9933
9936
|
return [filteredDrawPositions[0], undefined];
|
|
9934
9937
|
} else {
|
|
@@ -9938,12 +9941,13 @@ function getRoundMatchUps$1({
|
|
|
9938
9941
|
// this accounts for ADVANCED fed positions which are NOT guaranteed to be in numeric order
|
|
9939
9942
|
// ... because a lower number fed position may be in { sideNumber: 2 } while an drawPosition advanced
|
|
9940
9943
|
// from the first round may be in { sideNumber: 1 }
|
|
9944
|
+
// const targetChunkIndex = (roundPosition - 1) * 2;
|
|
9941
9945
|
|
|
9942
9946
|
|
|
9943
9947
|
const targetChunkIndex = (roundPosition - 1) * 2;
|
|
9944
9948
|
const targetChunks = priorRoundDrawPositionChunks.slice(targetChunkIndex, targetChunkIndex + 2);
|
|
9945
9949
|
const orderedPositions = targetChunks.map(chunk => {
|
|
9946
|
-
const drawPositionInChunk =
|
|
9950
|
+
const drawPositionInChunk = filteredDrawPositions === null || filteredDrawPositions === void 0 ? void 0 : filteredDrawPositions.find(drawPosition => chunk.includes(drawPosition));
|
|
9947
9951
|
return drawPositionInChunk;
|
|
9948
9952
|
});
|
|
9949
9953
|
return orderedPositions;
|
|
@@ -11086,7 +11090,8 @@ function getOrderedDrawPositions({
|
|
|
11086
11090
|
}
|
|
11087
11091
|
|
|
11088
11092
|
const targetRoundProfile = roundProfile[roundNumber];
|
|
11089
|
-
const
|
|
11093
|
+
const pairedDrawPositions = targetRoundProfile === null || targetRoundProfile === void 0 ? void 0 : targetRoundProfile.pairedDrawPositions;
|
|
11094
|
+
const displayOrder = (pairedDrawPositions === null || pairedDrawPositions === void 0 ? void 0 : pairedDrawPositions.find(pair => overlap(pair || [], drawPositions.filter(Boolean)))) || unassignedDrawPositions; // ############# IMPORTANT DO NOT CHANGE #################
|
|
11090
11095
|
// when both present, drawPositions are always sorted numerically
|
|
11091
11096
|
// this holds true even when fed positions encounter each other in later rounds
|
|
11092
11097
|
// { sideNumber: 1 } always goes to the lower drawPosition
|
|
@@ -11098,8 +11103,16 @@ function getOrderedDrawPositions({
|
|
|
11098
11103
|
|
|
11099
11104
|
if (allNumeric$1(drawPositions)) {
|
|
11100
11105
|
const orderedDrawPositions = drawPositions.sort(numericSort);
|
|
11101
|
-
|
|
11106
|
+
if (getDevContext({
|
|
11107
|
+
sideNumbers: true
|
|
11108
|
+
}) && drawPositions.length < 2) console.log({
|
|
11109
|
+
drawPositions,
|
|
11110
|
+
pairedDrawPositions,
|
|
11102
11111
|
orderedDrawPositions,
|
|
11112
|
+
displayOrder
|
|
11113
|
+
});
|
|
11114
|
+
return {
|
|
11115
|
+
orderedDrawPositions: orderedDrawPositions.length === 2 ? orderedDrawPositions : displayOrder,
|
|
11103
11116
|
displayOrder: isFeedRound ? orderedDrawPositions : displayOrder
|
|
11104
11117
|
};
|
|
11105
11118
|
} // ############# IMPORTANT DO NOT CHANGE #################
|
|
@@ -11696,6 +11709,7 @@ function getAllStructureMatchUps({
|
|
|
11696
11709
|
|
|
11697
11710
|
let collectionPositionMatchUps = {},
|
|
11698
11711
|
roundMatchUps = {};
|
|
11712
|
+
tournamentParticipants = tournamentParticipants || (tournamentRecord === null || tournamentRecord === void 0 ? void 0 : tournamentRecord.participants);
|
|
11699
11713
|
|
|
11700
11714
|
if (!structure) {
|
|
11701
11715
|
return {
|
|
@@ -11752,7 +11766,6 @@ function getAllStructureMatchUps({
|
|
|
11752
11766
|
seedAssignments: structureSeedAssignments
|
|
11753
11767
|
} = getStructureSeedAssignments({
|
|
11754
11768
|
drawDefinition,
|
|
11755
|
-
matchUpsMap,
|
|
11756
11769
|
structure
|
|
11757
11770
|
}); // enables passing in seedAssignments rather than using structureSeedAssignments
|
|
11758
11771
|
|
|
@@ -11999,13 +12012,15 @@ function getAllStructureMatchUps({
|
|
|
11999
12012
|
displayOrder
|
|
12000
12013
|
} = getOrderedDrawPositions({
|
|
12001
12014
|
drawPositions,
|
|
12002
|
-
roundProfile,
|
|
12003
12015
|
roundPosition,
|
|
12016
|
+
roundProfile,
|
|
12004
12017
|
roundNumber
|
|
12005
12018
|
});
|
|
12006
12019
|
const isFeedRound = roundProfile[roundNumber] && roundProfile[roundNumber].feedRound;
|
|
12007
|
-
const reversedDisplayOrder = displayOrder[0] !== orderedDrawPositions[0];
|
|
12008
|
-
|
|
12020
|
+
const reversedDisplayOrder = displayOrder[0] !== orderedDrawPositions[0]; // ensure there are two sides generated
|
|
12021
|
+
|
|
12022
|
+
const sideDrawPositions = orderedDrawPositions.concat(undefined, undefined).slice(0, 2);
|
|
12023
|
+
const sides = sideDrawPositions.map((drawPosition, index) => {
|
|
12009
12024
|
var _matchUp$sides;
|
|
12010
12025
|
|
|
12011
12026
|
const sideNumber = index + 1;
|
|
@@ -12961,11 +12976,11 @@ function nextRoundMatchUp({
|
|
|
12961
12976
|
}
|
|
12962
12977
|
|
|
12963
12978
|
function getTargetMatchUp({
|
|
12964
|
-
|
|
12979
|
+
sourceRoundMatchUpCount,
|
|
12965
12980
|
inContextDrawMatchUps,
|
|
12966
|
-
targetLink,
|
|
12967
12981
|
sourceRoundPosition,
|
|
12968
|
-
|
|
12982
|
+
drawDefinition,
|
|
12983
|
+
targetLink
|
|
12969
12984
|
}) {
|
|
12970
12985
|
if (!targetLink) return {
|
|
12971
12986
|
error: MISSING_TARGET_LINK
|
|
@@ -17023,7 +17038,11 @@ function removeDirectedParticipants(params) {
|
|
|
17023
17038
|
winnerParticipantId: undefined,
|
|
17024
17039
|
loserParticipantId: undefined
|
|
17025
17040
|
});
|
|
17026
|
-
const drawPositionMatchUps = sourceMatchUps.filter(matchUp =>
|
|
17041
|
+
const drawPositionMatchUps = sourceMatchUps.filter(matchUp => {
|
|
17042
|
+
var _matchUp$drawPosition;
|
|
17043
|
+
|
|
17044
|
+
return (_matchUp$drawPosition = matchUp.drawPositions) === null || _matchUp$drawPosition === void 0 ? void 0 : _matchUp$drawPosition.includes(loserDrawPosition);
|
|
17045
|
+
});
|
|
17027
17046
|
|
|
17028
17047
|
if (winnerMatchUp) {
|
|
17029
17048
|
const result = removeDirectedWinner({
|
|
@@ -17674,7 +17693,6 @@ function advanceWinner({
|
|
|
17674
17693
|
matchUpId: winnerMatchUp.matchUpId,
|
|
17675
17694
|
inContextDrawMatchUps,
|
|
17676
17695
|
drawDefinition,
|
|
17677
|
-
iterative: 'brightmagenta',
|
|
17678
17696
|
matchUpsMap
|
|
17679
17697
|
});
|
|
17680
17698
|
} else if (drawPositionIsBye) {
|
|
@@ -17767,7 +17785,7 @@ function getUpdatedDrawPositions({
|
|
|
17767
17785
|
}) {
|
|
17768
17786
|
let positionAdded;
|
|
17769
17787
|
let positionAssigned = drawPositions === null || drawPositions === void 0 ? void 0 : drawPositions.includes(drawPosition);
|
|
17770
|
-
const updatedDrawPositions = positionAssigned ? drawPositions : [].concat(...drawPositions, undefined, undefined).slice(0, 2) // accounts for empty array, should always have length 2
|
|
17788
|
+
const updatedDrawPositions = positionAssigned ? drawPositions || [] : [].concat(...drawPositions, undefined, undefined).slice(0, 2) // accounts for empty array, should always have length 2
|
|
17771
17789
|
.map(position => {
|
|
17772
17790
|
if (!position && !positionAssigned) {
|
|
17773
17791
|
positionAssigned = true;
|
|
@@ -17776,7 +17794,7 @@ function getUpdatedDrawPositions({
|
|
|
17776
17794
|
} else {
|
|
17777
17795
|
return position;
|
|
17778
17796
|
}
|
|
17779
|
-
}).sort(numericSort);
|
|
17797
|
+
}).sort(numericSort).filter(Boolean);
|
|
17780
17798
|
return {
|
|
17781
17799
|
updatedDrawPositions,
|
|
17782
17800
|
positionAdded,
|
|
@@ -17786,23 +17804,24 @@ function getUpdatedDrawPositions({
|
|
|
17786
17804
|
|
|
17787
17805
|
function getWalkoverWinningSide({
|
|
17788
17806
|
inContextDrawMatchUps,
|
|
17789
|
-
|
|
17790
|
-
|
|
17807
|
+
drawPosition,
|
|
17808
|
+
matchUpId
|
|
17791
17809
|
}) {
|
|
17792
17810
|
// determine which sideNumber { drawPosition } will be and assign winningSide
|
|
17793
17811
|
// NOTE: at present this is dependent on presence of .winnerMatchUpId and .loserMatchUpId
|
|
17794
17812
|
// TODO: reusable function that will be able to use position targeting using links
|
|
17795
17813
|
// which will need to filter by previous round then get positionTargets for each matchUp in the round
|
|
17796
|
-
// sourceMatchUps MUST be sorted by roundPosition
|
|
17797
17814
|
const sourceMatchUps = inContextDrawMatchUps.filter(({
|
|
17798
17815
|
winnerMatchUpId,
|
|
17799
17816
|
loserMatchUpId
|
|
17800
|
-
}) => loserMatchUpId === matchUpId || winnerMatchUpId === matchUpId)
|
|
17801
|
-
|
|
17802
|
-
|
|
17803
|
-
|
|
17817
|
+
}) => loserMatchUpId === matchUpId || winnerMatchUpId === matchUpId) // sourceMatchUps MUST be sorted by roundPosition
|
|
17818
|
+
.sort((a, b) => a.roundPosition - b.roundPosition);
|
|
17819
|
+
const matchUp = inContextDrawMatchUps.find(matchUp => matchUp.matchUpId === matchUpId);
|
|
17820
|
+
const feedRound = matchUp.feedRound;
|
|
17804
17821
|
return feedRound ? 1 : sourceMatchUps.reduce((sideNumber, sourceMatchUp, index) => {
|
|
17805
|
-
|
|
17822
|
+
var _sourceMatchUp$drawPo;
|
|
17823
|
+
|
|
17824
|
+
if ((_sourceMatchUp$drawPo = sourceMatchUp.drawPositions) !== null && _sourceMatchUp$drawPo !== void 0 && _sourceMatchUp$drawPo.includes(drawPosition)) return index + 1;
|
|
17806
17825
|
return sideNumber;
|
|
17807
17826
|
}, undefined);
|
|
17808
17827
|
}
|
|
@@ -18113,9 +18132,12 @@ function conditionallyAdvanceDrawPosition(params) {
|
|
|
18113
18132
|
if (result.error) return result; // when there is an existing WO/WO created WALKOVER it is replaced
|
|
18114
18133
|
// with a DOUBLE_WALKOVER and move on to advancing from this position
|
|
18115
18134
|
|
|
18116
|
-
if (existingWalkover)
|
|
18117
|
-
|
|
18118
|
-
|
|
18135
|
+
if (existingWalkover) {
|
|
18136
|
+
return doubleWalkoverAdvancement({ ...params,
|
|
18137
|
+
targetData
|
|
18138
|
+
});
|
|
18139
|
+
}
|
|
18140
|
+
|
|
18119
18141
|
if (!nextWinnerMatchUp) return { ...SUCCESS
|
|
18120
18142
|
}; // any remaining drawPosition in winnerMatchUp should be advanced
|
|
18121
18143
|
|
|
@@ -18141,23 +18163,28 @@ function conditionallyAdvanceDrawPosition(params) {
|
|
|
18141
18163
|
});
|
|
18142
18164
|
|
|
18143
18165
|
if (nextWinnerMatchUpHasDrawPosition) {
|
|
18144
|
-
// if the next winnerMatchUp already has a drawPosition
|
|
18166
|
+
const nextDrawPositionToAdvance = nextWinnerMatchUpDrawPositions.filter(Boolean)[0]; // if the next winnerMatchUp already has a drawPosition
|
|
18167
|
+
|
|
18168
|
+
const winningSide = getWalkoverWinningSide({
|
|
18169
|
+
drawPosition: nextDrawPositionToAdvance,
|
|
18170
|
+
matchUpId: noContextNextWinnerMatchUp.matchUpId,
|
|
18171
|
+
inContextDrawMatchUps
|
|
18172
|
+
});
|
|
18145
18173
|
const result = modifyMatchUpScore({
|
|
18146
18174
|
matchUpId: noContextNextWinnerMatchUp.matchUpId,
|
|
18147
18175
|
matchUp: noContextNextWinnerMatchUp,
|
|
18148
18176
|
matchUpStatus: WALKOVER$1,
|
|
18149
18177
|
removeScore: true,
|
|
18150
18178
|
drawDefinition,
|
|
18151
|
-
winningSide
|
|
18179
|
+
winningSide
|
|
18152
18180
|
});
|
|
18153
18181
|
if (result.error) return result;
|
|
18154
|
-
const drawPositionToAdvance = nextWinnerMatchUpDrawPositions.filter(Boolean)[0];
|
|
18155
18182
|
return advanceDrawPosition({
|
|
18156
|
-
drawPositionToAdvance,
|
|
18183
|
+
drawPositionToAdvance: nextDrawPositionToAdvance,
|
|
18184
|
+
matchUpId: noContextNextWinnerMatchUp.matchUpId,
|
|
18157
18185
|
inContextDrawMatchUps,
|
|
18158
18186
|
drawDefinition,
|
|
18159
|
-
matchUpsMap
|
|
18160
|
-
matchUpId: noContextNextWinnerMatchUp.matchUpId
|
|
18187
|
+
matchUpsMap
|
|
18161
18188
|
});
|
|
18162
18189
|
} else if (nextWinnerMatchUp.matchUpStatus === WALKOVER$1) {
|
|
18163
18190
|
// if the next winnerMatchUp is a doubleWalkover
|
|
@@ -20039,15 +20066,23 @@ function removeDoubleWalkover(params) {
|
|
|
20039
20066
|
}
|
|
20040
20067
|
|
|
20041
20068
|
if (pairedPreviousMatchUpComplete) {
|
|
20069
|
+
var _winnerMatchUp$drawPo;
|
|
20070
|
+
|
|
20042
20071
|
const sourceDrawPositions = matchUp.drawPositions || [];
|
|
20043
|
-
let targetDrawPositions = winnerMatchUp.drawPositions.filter(Boolean);
|
|
20072
|
+
let targetDrawPositions = (_winnerMatchUp$drawPo = winnerMatchUp.drawPositions) === null || _winnerMatchUp$drawPo === void 0 ? void 0 : _winnerMatchUp$drawPo.filter(Boolean);
|
|
20044
20073
|
|
|
20045
20074
|
if (overlap(sourceDrawPositions, targetDrawPositions)) {
|
|
20046
|
-
|
|
20075
|
+
var _targetDrawPositions;
|
|
20076
|
+
|
|
20077
|
+
targetDrawPositions = (_targetDrawPositions = targetDrawPositions) === null || _targetDrawPositions === void 0 ? void 0 : _targetDrawPositions.filter(drawPosition => !sourceDrawPositions.includes(drawPosition));
|
|
20047
20078
|
}
|
|
20048
20079
|
|
|
20049
20080
|
const possibleBranchDrawPositions = sourceDrawPositions.concat(pairedPreviousDrawPositions);
|
|
20050
|
-
const drawPositionToRemove = possibleBranchDrawPositions.find(drawPosition =>
|
|
20081
|
+
const drawPositionToRemove = possibleBranchDrawPositions.find(drawPosition => {
|
|
20082
|
+
var _targetDrawPositions2;
|
|
20083
|
+
|
|
20084
|
+
return (_targetDrawPositions2 = targetDrawPositions) === null || _targetDrawPositions2 === void 0 ? void 0 : _targetDrawPositions2.includes(drawPosition);
|
|
20085
|
+
});
|
|
20051
20086
|
|
|
20052
20087
|
if (nextWinnerMatchUp && drawPositionToRemove) {
|
|
20053
20088
|
const result = removeDirectedWinner({
|
|
@@ -20223,20 +20258,21 @@ function isActiveDownstream(params) {
|
|
|
20223
20258
|
});
|
|
20224
20259
|
let winnerTargetData = winnerMatchUp && positionTargets({
|
|
20225
20260
|
matchUpId: winnerMatchUp.matchUpId,
|
|
20226
|
-
|
|
20227
|
-
|
|
20261
|
+
inContextDrawMatchUps,
|
|
20262
|
+
drawDefinition
|
|
20228
20263
|
});
|
|
20229
20264
|
const loserActive = loserTargetData && isActiveDownstream({
|
|
20230
20265
|
inContextDrawMatchUps,
|
|
20231
|
-
|
|
20232
|
-
|
|
20266
|
+
targetData: loserTargetData,
|
|
20267
|
+
drawDefinition
|
|
20233
20268
|
});
|
|
20234
20269
|
const winnerActive = winnerTargetData && isActiveDownstream({
|
|
20235
20270
|
inContextDrawMatchUps,
|
|
20236
|
-
|
|
20237
|
-
|
|
20271
|
+
targetData: winnerTargetData,
|
|
20272
|
+
drawDefinition
|
|
20238
20273
|
});
|
|
20239
|
-
|
|
20274
|
+
const isActive = !!(winnerActive || loserActive);
|
|
20275
|
+
return isActive;
|
|
20240
20276
|
}
|
|
20241
20277
|
|
|
20242
20278
|
/**
|
|
@@ -20498,7 +20534,7 @@ function setMatchUpStatus$2(params) {
|
|
|
20498
20534
|
matchUpsMap,
|
|
20499
20535
|
event
|
|
20500
20536
|
});
|
|
20501
|
-
const tieFormat = (dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.tieFormat) || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
|
|
20537
|
+
const tieFormat = (dualMatchUp === null || dualMatchUp === void 0 ? void 0 : dualMatchUp.tieFormat) || (structure === null || structure === void 0 ? void 0 : structure.tieFormat) || (drawDefinition === null || drawDefinition === void 0 ? void 0 : drawDefinition.tieFormat) || (event === null || event === void 0 ? void 0 : event.tieFormat) || undefined;
|
|
20502
20538
|
const {
|
|
20503
20539
|
projectedWinningSide
|
|
20504
20540
|
} = getProjectedDualWinningSide({
|
|
@@ -22676,10 +22712,132 @@ const scaleConstants = {
|
|
|
22676
22712
|
SEEDING
|
|
22677
22713
|
};
|
|
22678
22714
|
|
|
22715
|
+
function getAccessorValue({
|
|
22716
|
+
element,
|
|
22717
|
+
accessor
|
|
22718
|
+
}) {
|
|
22719
|
+
if (typeof accessor !== 'string') return {
|
|
22720
|
+
values: []
|
|
22721
|
+
};
|
|
22722
|
+
const targetElement = makeDeepCopy(element);
|
|
22723
|
+
const attributes = accessor.split('.');
|
|
22724
|
+
let value,
|
|
22725
|
+
values = [];
|
|
22726
|
+
processKeys({
|
|
22727
|
+
targetElement,
|
|
22728
|
+
attributes
|
|
22729
|
+
});
|
|
22730
|
+
const result = {
|
|
22731
|
+
value
|
|
22732
|
+
};
|
|
22733
|
+
if (values.length) result.values = values;
|
|
22734
|
+
return result;
|
|
22735
|
+
|
|
22736
|
+
function processKeys({
|
|
22737
|
+
targetElement,
|
|
22738
|
+
attributes = [],
|
|
22739
|
+
significantCharacters
|
|
22740
|
+
}) {
|
|
22741
|
+
for (const [index, attribute] of attributes.entries()) {
|
|
22742
|
+
if (targetElement && targetElement[attribute]) {
|
|
22743
|
+
if (Array.isArray(targetElement[attribute])) {
|
|
22744
|
+
const values = targetElement[attribute];
|
|
22745
|
+
const remainingKeys = attributes.slice(index);
|
|
22746
|
+
values.forEach(nestedTarget => processKeys({
|
|
22747
|
+
targetElement: nestedTarget,
|
|
22748
|
+
attributes: remainingKeys
|
|
22749
|
+
}));
|
|
22750
|
+
} else {
|
|
22751
|
+
targetElement = targetElement[attribute];
|
|
22752
|
+
checkValue({
|
|
22753
|
+
targetElement,
|
|
22754
|
+
index
|
|
22755
|
+
});
|
|
22756
|
+
}
|
|
22757
|
+
}
|
|
22758
|
+
}
|
|
22759
|
+
|
|
22760
|
+
function checkValue({
|
|
22761
|
+
targetElement,
|
|
22762
|
+
index
|
|
22763
|
+
}) {
|
|
22764
|
+
if (targetElement && index === attributes.length - 1 && ['string', 'number'].includes(typeof targetElement)) {
|
|
22765
|
+
const extractedValue = significantCharacters ? targetElement.slice(0, significantCharacters) : targetElement;
|
|
22766
|
+
|
|
22767
|
+
if (value) {
|
|
22768
|
+
if (!values.includes(extractedValue)) {
|
|
22769
|
+
values.push(extractedValue);
|
|
22770
|
+
}
|
|
22771
|
+
} else {
|
|
22772
|
+
value = extractedValue;
|
|
22773
|
+
values.push(extractedValue);
|
|
22774
|
+
}
|
|
22775
|
+
}
|
|
22776
|
+
}
|
|
22777
|
+
}
|
|
22778
|
+
}
|
|
22779
|
+
|
|
22780
|
+
function participantScaleItem({
|
|
22781
|
+
requireTimeStamp,
|
|
22782
|
+
scaleAttributes,
|
|
22783
|
+
participant
|
|
22784
|
+
}) {
|
|
22785
|
+
if (!participant) return {
|
|
22786
|
+
error: MISSING_PARTICIPANT
|
|
22787
|
+
};
|
|
22788
|
+
if (typeof scaleAttributes !== 'object') return {
|
|
22789
|
+
error: INVALID_VALUES
|
|
22790
|
+
};
|
|
22791
|
+
if (!participant.timeItems) participant.timeItems = [];
|
|
22792
|
+
|
|
22793
|
+
if (participant && Array.isArray(participant.timeItems)) {
|
|
22794
|
+
const {
|
|
22795
|
+
accessor,
|
|
22796
|
+
scaleType,
|
|
22797
|
+
eventType,
|
|
22798
|
+
scaleName
|
|
22799
|
+
} = scaleAttributes;
|
|
22800
|
+
const filterType = [SCALE, scaleType, eventType, scaleName].join('.');
|
|
22801
|
+
const filteredTimeItems = participant.timeItems.filter(timeItem => (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) === filterType).filter(timeItem => !requireTimeStamp || (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemDate)).sort((a, b) => new Date(a.createdAt || undefined) - new Date(b.createdAt || undefined));
|
|
22802
|
+
const timeItem = filteredTimeItems.pop();
|
|
22803
|
+
|
|
22804
|
+
if (timeItem) {
|
|
22805
|
+
const [itemSubject, scaleType, eventType, scaleName] = timeItem.itemType.split('.');
|
|
22806
|
+
if (itemSubject !== SCALE) return {
|
|
22807
|
+
error: INVALID_SCALE_ITEM
|
|
22808
|
+
};
|
|
22809
|
+
const accessorValue = accessor && getAccessorValue({
|
|
22810
|
+
element: timeItem.itemValue,
|
|
22811
|
+
accessor
|
|
22812
|
+
});
|
|
22813
|
+
const scaleValue = accessor ? accessorValue.value : timeItem.itemValue;
|
|
22814
|
+
const scaleItem = {
|
|
22815
|
+
scaleDate: timeItem.itemDate,
|
|
22816
|
+
scaleName,
|
|
22817
|
+
scaleType,
|
|
22818
|
+
eventType,
|
|
22819
|
+
scaleValue
|
|
22820
|
+
};
|
|
22821
|
+
return {
|
|
22822
|
+
scaleItem
|
|
22823
|
+
};
|
|
22824
|
+
} else {
|
|
22825
|
+
return {
|
|
22826
|
+
error: SCALE_ITEM_NOT_FOUND
|
|
22827
|
+
};
|
|
22828
|
+
}
|
|
22829
|
+
}
|
|
22830
|
+
|
|
22831
|
+
return {
|
|
22832
|
+
error: MISSING_PARTICIPANT
|
|
22833
|
+
};
|
|
22834
|
+
}
|
|
22835
|
+
|
|
22679
22836
|
function addParticipantContext(params) {
|
|
22680
22837
|
var _params$tournamentPar;
|
|
22681
22838
|
|
|
22682
22839
|
const participantIdsWithConflicts = [];
|
|
22840
|
+
const eventsPublishStatuses = {};
|
|
22683
22841
|
const drawSizes = {};
|
|
22684
22842
|
const participantIdMap = {};
|
|
22685
22843
|
|
|
@@ -22774,7 +22932,7 @@ function addParticipantContext(params) {
|
|
|
22774
22932
|
|
|
22775
22933
|
// loop through all filtered events and capture events played
|
|
22776
22934
|
(_params$tournamentEve = params.tournamentEvents) === null || _params$tournamentEve === void 0 ? void 0 : _params$tournamentEve.forEach(rawEvent => {
|
|
22777
|
-
var _event$drawDefinition, _eventInfo$_flightPro, _eventInfo$_flightPro2;
|
|
22935
|
+
var _timeItem$itemValue, _event$drawDefinition, _eventInfo$_flightPro, _eventInfo$_flightPro2;
|
|
22778
22936
|
|
|
22779
22937
|
const event = makeDeepCopy(rawEvent, true, true);
|
|
22780
22938
|
const {
|
|
@@ -22791,7 +22949,37 @@ function addParticipantContext(params) {
|
|
|
22791
22949
|
};
|
|
22792
22950
|
const extensionKeys = event && Object.keys(event).filter(key => key[0] === '_');
|
|
22793
22951
|
extensionKeys === null || extensionKeys === void 0 ? void 0 : extensionKeys.forEach(extensionKey => eventInfo[extensionKey] = event[extensionKey]);
|
|
22794
|
-
const eventEntries = event.entries || [];
|
|
22952
|
+
const eventEntries = event.entries || [];
|
|
22953
|
+
const itemType = `${PUBLISH}.${STATUS$1}`;
|
|
22954
|
+
const {
|
|
22955
|
+
timeItem
|
|
22956
|
+
} = getEventTimeItem({
|
|
22957
|
+
itemType,
|
|
22958
|
+
event
|
|
22959
|
+
});
|
|
22960
|
+
|
|
22961
|
+
if (timeItem !== null && timeItem !== void 0 && (_timeItem$itemValue = timeItem.itemValue) !== null && _timeItem$itemValue !== void 0 && _timeItem$itemValue.PUBLIC) {
|
|
22962
|
+
var _timeItem$itemValue2;
|
|
22963
|
+
|
|
22964
|
+
const {
|
|
22965
|
+
drawIds: publishedDrawIds = [],
|
|
22966
|
+
seeding
|
|
22967
|
+
} = (timeItem === null || timeItem === void 0 ? void 0 : (_timeItem$itemValue2 = timeItem.itemValue) === null || _timeItem$itemValue2 === void 0 ? void 0 : _timeItem$itemValue2.PUBLIC) || {};
|
|
22968
|
+
const publishedSeeding = {
|
|
22969
|
+
event: undefined,
|
|
22970
|
+
// seeding can be present for all entries in an event when no flights have been defined
|
|
22971
|
+
drawIds: [],
|
|
22972
|
+
// seeding can be specific to drawIds
|
|
22973
|
+
stages: [] // seeding can be specific to { stageSequence: 1 } for each stage
|
|
22974
|
+
|
|
22975
|
+
};
|
|
22976
|
+
if (seeding) Object.assign(publishedSeeding, timeItem.itemValue.PUBLIC.seeding);
|
|
22977
|
+
eventsPublishStatuses[eventId] = {
|
|
22978
|
+
publishedDrawIds,
|
|
22979
|
+
publishedSeeding
|
|
22980
|
+
};
|
|
22981
|
+
} // don't allow system extensions to be copied to participants
|
|
22982
|
+
|
|
22795
22983
|
|
|
22796
22984
|
const disallowedConstants = [].concat(...Object.values(extensionConstants));
|
|
22797
22985
|
const disallowedKeys = disallowedConstants.map(constant => `_${constant}`);
|
|
@@ -23230,7 +23418,8 @@ function addParticipantContext(params) {
|
|
|
23230
23418
|
}
|
|
23231
23419
|
|
|
23232
23420
|
return {
|
|
23233
|
-
participantIdsWithConflicts
|
|
23421
|
+
participantIdsWithConflicts,
|
|
23422
|
+
eventsPublishStatuses
|
|
23234
23423
|
};
|
|
23235
23424
|
}
|
|
23236
23425
|
|
|
@@ -23304,8 +23493,75 @@ function annotateParticipant({
|
|
|
23304
23493
|
};
|
|
23305
23494
|
const participantDraws = Object.values(draws);
|
|
23306
23495
|
const participantEvents = Object.values(events);
|
|
23307
|
-
|
|
23308
|
-
|
|
23496
|
+
|
|
23497
|
+
if (withDraws && participantDraws) {
|
|
23498
|
+
participant.draws = participantDraws;
|
|
23499
|
+
|
|
23500
|
+
for (const participantDraw of participantDraws) {
|
|
23501
|
+
var _result;
|
|
23502
|
+
|
|
23503
|
+
const event = participantEvents === null || participantEvents === void 0 ? void 0 : participantEvents.find(e => e.eventId === participantDraw.eventId);
|
|
23504
|
+
const {
|
|
23505
|
+
categoryName,
|
|
23506
|
+
ageCategoryCode
|
|
23507
|
+
} = (event === null || event === void 0 ? void 0 : event.category) || {};
|
|
23508
|
+
let result = participantScaleItem({
|
|
23509
|
+
scaleAttributes: {
|
|
23510
|
+
scaleType: SEEDING,
|
|
23511
|
+
scaleName: participantDraw.drawId,
|
|
23512
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType
|
|
23513
|
+
},
|
|
23514
|
+
participant
|
|
23515
|
+
});
|
|
23516
|
+
|
|
23517
|
+
if ((_result = result) !== null && _result !== void 0 && _result.scaleItem) {
|
|
23518
|
+
participantDraw.seedValue = result.scaleItem.scaleValue;
|
|
23519
|
+
} else {
|
|
23520
|
+
var _result2;
|
|
23521
|
+
|
|
23522
|
+
result = participantScaleItem({
|
|
23523
|
+
scaleAttributes: {
|
|
23524
|
+
scaleType: SEEDING,
|
|
23525
|
+
scaleName: categoryName || ageCategoryCode,
|
|
23526
|
+
eventType: event === null || event === void 0 ? void 0 : event.eventType
|
|
23527
|
+
},
|
|
23528
|
+
participant
|
|
23529
|
+
});
|
|
23530
|
+
|
|
23531
|
+
if ((_result2 = result) !== null && _result2 !== void 0 && _result2.scaleItem) {
|
|
23532
|
+
participantDraw.seedValue = result.scaleItem.scaleValue;
|
|
23533
|
+
}
|
|
23534
|
+
}
|
|
23535
|
+
}
|
|
23536
|
+
}
|
|
23537
|
+
|
|
23538
|
+
if (withEvents && participantEvents) {
|
|
23539
|
+
participant.events = participantEvents;
|
|
23540
|
+
|
|
23541
|
+
for (const participantEvent of participantEvents) {
|
|
23542
|
+
const {
|
|
23543
|
+
categoryName,
|
|
23544
|
+
ageCategoryCode
|
|
23545
|
+
} = participantEvent.category || {};
|
|
23546
|
+
const scaleAttributes = {
|
|
23547
|
+
scaleType: SEEDING,
|
|
23548
|
+
scaleName: categoryName || ageCategoryCode,
|
|
23549
|
+
eventType: participantEvent.eventType
|
|
23550
|
+
};
|
|
23551
|
+
const result = participantScaleItem({
|
|
23552
|
+
scaleAttributes,
|
|
23553
|
+
participant
|
|
23554
|
+
});
|
|
23555
|
+
const {
|
|
23556
|
+
scaleItem
|
|
23557
|
+
} = result;
|
|
23558
|
+
|
|
23559
|
+
if (scaleItem) {
|
|
23560
|
+
participantEvent.seedValue = scaleItem.scaleValue;
|
|
23561
|
+
}
|
|
23562
|
+
}
|
|
23563
|
+
}
|
|
23564
|
+
|
|
23309
23565
|
const participantOpponents = Object.values(opponents).flat();
|
|
23310
23566
|
|
|
23311
23567
|
if (withOpponents && participantOpponents !== null && participantOpponents !== void 0 && participantOpponents.length) {
|
|
@@ -23412,71 +23668,6 @@ function annotateParticipant({
|
|
|
23412
23668
|
};
|
|
23413
23669
|
}
|
|
23414
23670
|
|
|
23415
|
-
function getAccessorValue({
|
|
23416
|
-
element,
|
|
23417
|
-
accessor
|
|
23418
|
-
}) {
|
|
23419
|
-
if (typeof accessor !== 'string') return {
|
|
23420
|
-
values: []
|
|
23421
|
-
};
|
|
23422
|
-
const targetElement = makeDeepCopy(element);
|
|
23423
|
-
const attributes = accessor.split('.');
|
|
23424
|
-
let value,
|
|
23425
|
-
values = [];
|
|
23426
|
-
processKeys({
|
|
23427
|
-
targetElement,
|
|
23428
|
-
attributes
|
|
23429
|
-
});
|
|
23430
|
-
const result = {
|
|
23431
|
-
value
|
|
23432
|
-
};
|
|
23433
|
-
if (values.length) result.values = values;
|
|
23434
|
-
return result;
|
|
23435
|
-
|
|
23436
|
-
function processKeys({
|
|
23437
|
-
targetElement,
|
|
23438
|
-
attributes = [],
|
|
23439
|
-
significantCharacters
|
|
23440
|
-
}) {
|
|
23441
|
-
for (const [index, attribute] of attributes.entries()) {
|
|
23442
|
-
if (targetElement && targetElement[attribute]) {
|
|
23443
|
-
if (Array.isArray(targetElement[attribute])) {
|
|
23444
|
-
const values = targetElement[attribute];
|
|
23445
|
-
const remainingKeys = attributes.slice(index);
|
|
23446
|
-
values.forEach(nestedTarget => processKeys({
|
|
23447
|
-
targetElement: nestedTarget,
|
|
23448
|
-
attributes: remainingKeys
|
|
23449
|
-
}));
|
|
23450
|
-
} else {
|
|
23451
|
-
targetElement = targetElement[attribute];
|
|
23452
|
-
checkValue({
|
|
23453
|
-
targetElement,
|
|
23454
|
-
index
|
|
23455
|
-
});
|
|
23456
|
-
}
|
|
23457
|
-
}
|
|
23458
|
-
}
|
|
23459
|
-
|
|
23460
|
-
function checkValue({
|
|
23461
|
-
targetElement,
|
|
23462
|
-
index
|
|
23463
|
-
}) {
|
|
23464
|
-
if (targetElement && index === attributes.length - 1 && ['string', 'number'].includes(typeof targetElement)) {
|
|
23465
|
-
const extractedValue = significantCharacters ? targetElement.slice(0, significantCharacters) : targetElement;
|
|
23466
|
-
|
|
23467
|
-
if (value) {
|
|
23468
|
-
if (!values.includes(extractedValue)) {
|
|
23469
|
-
values.push(extractedValue);
|
|
23470
|
-
}
|
|
23471
|
-
} else {
|
|
23472
|
-
value = extractedValue;
|
|
23473
|
-
values.push(extractedValue);
|
|
23474
|
-
}
|
|
23475
|
-
}
|
|
23476
|
-
}
|
|
23477
|
-
}
|
|
23478
|
-
}
|
|
23479
|
-
|
|
23480
23671
|
function filterParticipants({
|
|
23481
23672
|
tournamentRecord,
|
|
23482
23673
|
participantFilters,
|
|
@@ -23678,7 +23869,7 @@ function getTournamentParticipants({
|
|
|
23678
23869
|
participants: tournamentParticipants
|
|
23679
23870
|
});
|
|
23680
23871
|
const addContext = withSignInStatus || withScheduleItems || scheduleAnalysis || withStatistics || withGroupings || withOpponents || withMatchUps || withEvents || withDraws || withISO;
|
|
23681
|
-
let participantIdsWithConflicts;
|
|
23872
|
+
let participantIdsWithConflicts, eventsPublishStatuses;
|
|
23682
23873
|
|
|
23683
23874
|
if (addContext) {
|
|
23684
23875
|
const result = addParticipantContext({
|
|
@@ -23698,6 +23889,7 @@ function getTournamentParticipants({
|
|
|
23698
23889
|
withISO
|
|
23699
23890
|
});
|
|
23700
23891
|
participantIdsWithConflicts = result === null || result === void 0 ? void 0 : result.participantIdsWithConflicts;
|
|
23892
|
+
eventsPublishStatuses = result === null || result === void 0 ? void 0 : result.eventsPublishStatuses;
|
|
23701
23893
|
}
|
|
23702
23894
|
|
|
23703
23895
|
const participantAttributes = policyDefinitions === null || policyDefinitions === void 0 ? void 0 : policyDefinitions[POLICY_TYPE_PARTICIPANT];
|
|
@@ -23710,8 +23902,9 @@ function getTournamentParticipants({
|
|
|
23710
23902
|
}
|
|
23711
23903
|
|
|
23712
23904
|
return {
|
|
23905
|
+
participantIdsWithConflicts,
|
|
23713
23906
|
tournamentParticipants,
|
|
23714
|
-
|
|
23907
|
+
eventsPublishStatuses
|
|
23715
23908
|
};
|
|
23716
23909
|
}
|
|
23717
23910
|
|
|
@@ -30071,10 +30264,7 @@ function buildRound({
|
|
|
30071
30264
|
roundNumber,
|
|
30072
30265
|
roundPosition,
|
|
30073
30266
|
matchUpStatus: TO_BE_PLAYED,
|
|
30074
|
-
|
|
30075
|
-
// UNDEFINED drawPositions
|
|
30076
|
-
// drawPositions: node.children.map((c) => c.drawPosition).filter(Boolean),
|
|
30077
|
-
drawPositions: node.children.map(c => c.drawPosition)
|
|
30267
|
+
drawPositions: node.children.map(c => c.drawPosition).filter(Boolean)
|
|
30078
30268
|
}; // matchUpType is derived for inContext matchUps from structure or drawDefinition
|
|
30079
30269
|
|
|
30080
30270
|
if (includeMatchUpType) matchUp.matchUpType = matchUpType;
|
|
@@ -31773,7 +31963,7 @@ function generatePositioningCandidate(params) {
|
|
|
31773
31963
|
} = params;
|
|
31774
31964
|
const errors = [];
|
|
31775
31965
|
let groupKey;
|
|
31776
|
-
const groupSize = Math.min(...drawPositionGroups.map(dpg => dpg.length));
|
|
31966
|
+
const groupSize = Math.min(...(drawPositionGroups === null || drawPositionGroups === void 0 ? void 0 : drawPositionGroups.map(dpg => dpg === null || dpg === void 0 ? void 0 : dpg.length).filter(Boolean)));
|
|
31777
31967
|
const isRoundRobin = groupSize > 2;
|
|
31778
31968
|
const candidatePositionAssignments = makeDeepCopy(initialPositionAssignments, false, true); // all drawPositions which are available for placement
|
|
31779
31969
|
|
|
@@ -36298,11 +36488,10 @@ function removeParticipantIdsFromAllTeams({
|
|
|
36298
36488
|
}
|
|
36299
36489
|
|
|
36300
36490
|
function deleteParticipants({
|
|
36301
|
-
teamDrawIds = [],
|
|
36302
36491
|
tournamentRecord,
|
|
36303
36492
|
participantIds
|
|
36304
36493
|
}) {
|
|
36305
|
-
var _tournamentRecord$par;
|
|
36494
|
+
var _tournamentRecord$par, _tournamentRecord$eve;
|
|
36306
36495
|
|
|
36307
36496
|
if (!tournamentRecord) return {
|
|
36308
36497
|
error: MISSING_TOURNAMENT_RECORD
|
|
@@ -36312,6 +36501,15 @@ function deleteParticipants({
|
|
|
36312
36501
|
};
|
|
36313
36502
|
const participantsCount = ((_tournamentRecord$par = tournamentRecord.participants) === null || _tournamentRecord$par === void 0 ? void 0 : _tournamentRecord$par.length) || 0;
|
|
36314
36503
|
if (!participantsCount) return SUCCESS;
|
|
36504
|
+
const teamDrawIds = (_tournamentRecord$eve = tournamentRecord.events) === null || _tournamentRecord$eve === void 0 ? void 0 : _tournamentRecord$eve.filter(({
|
|
36505
|
+
eventType
|
|
36506
|
+
}) => eventType === TEAM$2).map(event => {
|
|
36507
|
+
var _event$drawDefinition;
|
|
36508
|
+
|
|
36509
|
+
return event === null || event === void 0 ? void 0 : (_event$drawDefinition = event.drawDefinitions) === null || _event$drawDefinition === void 0 ? void 0 : _event$drawDefinition.map(({
|
|
36510
|
+
drawId
|
|
36511
|
+
}) => drawId);
|
|
36512
|
+
}).flat(Infinity);
|
|
36315
36513
|
const {
|
|
36316
36514
|
tournamentParticipants
|
|
36317
36515
|
} = getTournamentParticipants({
|
|
@@ -36322,34 +36520,34 @@ function deleteParticipants({
|
|
|
36322
36520
|
tournamentRecord
|
|
36323
36521
|
});
|
|
36324
36522
|
|
|
36325
|
-
const
|
|
36523
|
+
const getPlacedPairParticipantIds = () => {
|
|
36326
36524
|
const {
|
|
36327
36525
|
matchUps
|
|
36328
36526
|
} = allTournamentMatchUps({
|
|
36329
|
-
tournamentRecord,
|
|
36330
36527
|
matchUpFilters: {
|
|
36331
36528
|
drawIds: teamDrawIds,
|
|
36332
36529
|
matchUpTypes: [DOUBLES$1]
|
|
36333
|
-
}
|
|
36530
|
+
},
|
|
36531
|
+
tournamentRecord
|
|
36334
36532
|
});
|
|
36335
|
-
const
|
|
36533
|
+
const placedPairParticipantIds = matchUps.map(({
|
|
36336
36534
|
sides
|
|
36337
36535
|
}) => sides.map(({
|
|
36338
36536
|
participantId
|
|
36339
36537
|
}) => participantId)).flat().filter(Boolean);
|
|
36340
|
-
return intersection(
|
|
36538
|
+
return intersection(placedPairParticipantIds, participantIds);
|
|
36341
36539
|
}; // for team draws it is necessary to check matchUps for pair participantIds "discovered" in collectionAssignments
|
|
36342
36540
|
|
|
36343
36541
|
|
|
36344
|
-
const
|
|
36542
|
+
const placedPairParticipantIds = (teamDrawIds === null || teamDrawIds === void 0 ? void 0 : teamDrawIds.length) && getPlacedPairParticipantIds();
|
|
36345
36543
|
const participantsInDraws = tournamentParticipants.filter(participant => {
|
|
36346
36544
|
var _participant$draws;
|
|
36347
36545
|
|
|
36348
36546
|
return (_participant$draws = participant.draws) === null || _participant$draws === void 0 ? void 0 : _participant$draws.filter(({
|
|
36349
36547
|
drawId
|
|
36350
|
-
}) => !teamDrawIds.length || !teamDrawIds.includes(drawId)).length;
|
|
36548
|
+
}) => !(teamDrawIds !== null && teamDrawIds !== void 0 && teamDrawIds.length) || !(teamDrawIds !== null && teamDrawIds !== void 0 && teamDrawIds.includes(drawId))).length;
|
|
36351
36549
|
});
|
|
36352
|
-
if (
|
|
36550
|
+
if (placedPairParticipantIds !== null && placedPairParticipantIds !== void 0 && placedPairParticipantIds.length || participantsInDraws.length) return {
|
|
36353
36551
|
error: PARTICIPANT_ASSIGNED_DRAW_POSITION
|
|
36354
36552
|
}; // If not active in draws, remove participantIds from all entries
|
|
36355
36553
|
|
|
@@ -37506,62 +37704,6 @@ function removeDelegatedOutcome$1({
|
|
|
37506
37704
|
});
|
|
37507
37705
|
}
|
|
37508
37706
|
|
|
37509
|
-
function participantScaleItem({
|
|
37510
|
-
requireTimeStamp,
|
|
37511
|
-
scaleAttributes,
|
|
37512
|
-
participant
|
|
37513
|
-
}) {
|
|
37514
|
-
if (!participant) return {
|
|
37515
|
-
error: MISSING_PARTICIPANT
|
|
37516
|
-
};
|
|
37517
|
-
if (typeof scaleAttributes !== 'object') return {
|
|
37518
|
-
error: INVALID_VALUES
|
|
37519
|
-
};
|
|
37520
|
-
if (!participant.timeItems) participant.timeItems = [];
|
|
37521
|
-
|
|
37522
|
-
if (participant && Array.isArray(participant.timeItems)) {
|
|
37523
|
-
const {
|
|
37524
|
-
accessor,
|
|
37525
|
-
scaleType,
|
|
37526
|
-
eventType,
|
|
37527
|
-
scaleName
|
|
37528
|
-
} = scaleAttributes;
|
|
37529
|
-
const filterType = [SCALE, scaleType, eventType, scaleName].join('.');
|
|
37530
|
-
const filteredTimeItems = participant.timeItems.filter(timeItem => (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemType) === filterType).filter(timeItem => !requireTimeStamp || (timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemDate)).sort((a, b) => new Date(a.createdAt || undefined) - new Date(b.createdAt || undefined));
|
|
37531
|
-
const timeItem = filteredTimeItems.pop();
|
|
37532
|
-
|
|
37533
|
-
if (timeItem) {
|
|
37534
|
-
const [itemSubject, scaleType, eventType, scaleName] = timeItem.itemType.split('.');
|
|
37535
|
-
if (itemSubject !== SCALE) return {
|
|
37536
|
-
error: INVALID_SCALE_ITEM
|
|
37537
|
-
};
|
|
37538
|
-
const accessorValue = accessor && getAccessorValue({
|
|
37539
|
-
element: timeItem.itemValue,
|
|
37540
|
-
accessor
|
|
37541
|
-
});
|
|
37542
|
-
const scaleValue = accessor ? accessorValue.value : timeItem.itemValue;
|
|
37543
|
-
const scaleItem = {
|
|
37544
|
-
scaleDate: timeItem.itemDate,
|
|
37545
|
-
scaleName,
|
|
37546
|
-
scaleType,
|
|
37547
|
-
eventType,
|
|
37548
|
-
scaleValue
|
|
37549
|
-
};
|
|
37550
|
-
return {
|
|
37551
|
-
scaleItem
|
|
37552
|
-
};
|
|
37553
|
-
} else {
|
|
37554
|
-
return {
|
|
37555
|
-
error: SCALE_ITEM_NOT_FOUND
|
|
37556
|
-
};
|
|
37557
|
-
}
|
|
37558
|
-
}
|
|
37559
|
-
|
|
37560
|
-
return {
|
|
37561
|
-
error: MISSING_PARTICIPANT
|
|
37562
|
-
};
|
|
37563
|
-
}
|
|
37564
|
-
|
|
37565
37707
|
function generateCandidate({
|
|
37566
37708
|
maxIterations = 5000,
|
|
37567
37709
|
// cap the processing intensity of the candidate generator
|
|
@@ -43818,7 +43960,11 @@ const namedFormats = {
|
|
|
43818
43960
|
},
|
|
43819
43961
|
[LAVER_CUP]: LAVER_CUP_TIE_FORMAT,
|
|
43820
43962
|
[DOMINANT_DUO]: DOMINANT_DUO_TIE_FORMAT,
|
|
43821
|
-
[TEAM_DOUBLES_3_AGGREGATION]: TEAM_AGGREGATION_TIE_FORMAT
|
|
43963
|
+
[TEAM_DOUBLES_3_AGGREGATION]: TEAM_AGGREGATION_TIE_FORMAT,
|
|
43964
|
+
[USTA_INTERSECTIONAL]: USTA_INTERSECTIONAL_TIE_FORMAT,
|
|
43965
|
+
[USTA_LEVEL_1]: USTA_LEVEL_1_TIE_FORMAT,
|
|
43966
|
+
[USTA_SOUTHERN_LEVEL_5]: USTA_SOUTHERN_LEVEL_5_TIE_FORMAT,
|
|
43967
|
+
[USTA_ZONAL]: USTA_ZONAL_TIE_FORMAT
|
|
43822
43968
|
};
|
|
43823
43969
|
const tieFormatDefaults = ({
|
|
43824
43970
|
namedFormat,
|
|
@@ -44436,7 +44582,6 @@ function assignTieMatchUpParticipantId(params) {
|
|
|
44436
44582
|
if (deleteParticipantId) {
|
|
44437
44583
|
const result = deleteParticipants({
|
|
44438
44584
|
participantIds: [deleteParticipantId],
|
|
44439
|
-
teamDrawIds: [drawDefinition.drawId],
|
|
44440
44585
|
tournamentRecord
|
|
44441
44586
|
});
|
|
44442
44587
|
if (result.error) console.log('cleanup', {
|
|
@@ -51649,25 +51794,132 @@ function completeDrawMatchUps({
|
|
|
51649
51794
|
matchUpStatusProfile,
|
|
51650
51795
|
completeAllMatchUps,
|
|
51651
51796
|
randomWinningSide,
|
|
51797
|
+
tournamentRecord,
|
|
51652
51798
|
drawDefinition,
|
|
51653
51799
|
completionGoal,
|
|
51654
51800
|
matchUpFormat,
|
|
51655
51801
|
event
|
|
51656
51802
|
}) {
|
|
51657
51803
|
const sortedStructures = drawDefinition.structures.slice().sort(structureSort);
|
|
51658
|
-
let completedCount = 0;
|
|
51804
|
+
let completedCount = 0;
|
|
51805
|
+
let {
|
|
51806
|
+
matchUps: firstRoundDualMatchUps,
|
|
51807
|
+
matchUpsMap
|
|
51808
|
+
} = getAllDrawMatchUps({
|
|
51809
|
+
contextFilters: {
|
|
51810
|
+
stages: [MAIN]
|
|
51811
|
+
},
|
|
51812
|
+
matchUpFilters: {
|
|
51813
|
+
matchUpTypes: [TEAM$3],
|
|
51814
|
+
roundNumbers: [1]
|
|
51815
|
+
},
|
|
51816
|
+
inContext: true,
|
|
51817
|
+
drawDefinition
|
|
51818
|
+
});
|
|
51819
|
+
|
|
51820
|
+
if (firstRoundDualMatchUps.length) {
|
|
51821
|
+
var _firstRoundDualMatchU;
|
|
51822
|
+
|
|
51823
|
+
const structureId = (_firstRoundDualMatchU = firstRoundDualMatchUps[0]) === null || _firstRoundDualMatchU === void 0 ? void 0 : _firstRoundDualMatchU.structureId;
|
|
51824
|
+
const {
|
|
51825
|
+
positionAssignments
|
|
51826
|
+
} = getPositionAssignments$1({
|
|
51827
|
+
drawDefinition,
|
|
51828
|
+
structureId
|
|
51829
|
+
});
|
|
51830
|
+
|
|
51831
|
+
if (positionAssignments !== null && positionAssignments !== void 0 && positionAssignments.length) {
|
|
51832
|
+
let {
|
|
51833
|
+
tournamentParticipants: teamParticipants
|
|
51834
|
+
} = getTournamentParticipants({
|
|
51835
|
+
participantFilters: {
|
|
51836
|
+
participantTypes: [TEAM$3]
|
|
51837
|
+
},
|
|
51838
|
+
tournamentRecord
|
|
51839
|
+
});
|
|
51840
|
+
|
|
51841
|
+
const assignParticipants = dualMatchUp => {
|
|
51842
|
+
const singlesMatchUps = dualMatchUp.tieMatchUps.filter(({
|
|
51843
|
+
matchUpType
|
|
51844
|
+
}) => matchUpType === SINGLES$1);
|
|
51845
|
+
const doublesMatchUps = dualMatchUp.tieMatchUps.filter(({
|
|
51846
|
+
matchUpType
|
|
51847
|
+
}) => matchUpType === DOUBLES$1);
|
|
51848
|
+
singlesMatchUps.forEach((singlesMatchUp, i) => {
|
|
51849
|
+
const tieMatchUpId = singlesMatchUp.matchUpId;
|
|
51850
|
+
singlesMatchUp.sides.forEach(side => {
|
|
51851
|
+
const {
|
|
51852
|
+
drawPosition
|
|
51853
|
+
} = side;
|
|
51854
|
+
const teamParticipant = teamParticipants.find(teamParticipant => {
|
|
51855
|
+
const {
|
|
51856
|
+
participantId
|
|
51857
|
+
} = teamParticipant;
|
|
51858
|
+
const assignment = positionAssignments.find(assignment => assignment.participantId === participantId);
|
|
51859
|
+
return assignment.drawPosition === drawPosition;
|
|
51860
|
+
});
|
|
51861
|
+
|
|
51862
|
+
if (teamParticipant) {
|
|
51863
|
+
const individualParticipantId = teamParticipant.individualParticipantIds[i];
|
|
51864
|
+
const result = assignTieMatchUpParticipantId({
|
|
51865
|
+
participantId: individualParticipantId,
|
|
51866
|
+
tournamentRecord,
|
|
51867
|
+
drawDefinition,
|
|
51868
|
+
tieMatchUpId,
|
|
51869
|
+
event
|
|
51870
|
+
});
|
|
51871
|
+
if (!result.success) console.log(result);
|
|
51872
|
+
}
|
|
51873
|
+
});
|
|
51874
|
+
});
|
|
51875
|
+
doublesMatchUps.forEach((doublesMatchUp, i) => {
|
|
51876
|
+
const tieMatchUpId = doublesMatchUp.matchUpId;
|
|
51877
|
+
doublesMatchUp.sides.forEach(side => {
|
|
51878
|
+
const {
|
|
51879
|
+
drawPosition
|
|
51880
|
+
} = side;
|
|
51881
|
+
const teamParticipant = teamParticipants.find(teamParticipant => {
|
|
51882
|
+
const {
|
|
51883
|
+
participantId
|
|
51884
|
+
} = teamParticipant;
|
|
51885
|
+
const assignment = positionAssignments.find(assignment => assignment.participantId === participantId);
|
|
51886
|
+
return assignment.drawPosition === drawPosition;
|
|
51887
|
+
});
|
|
51888
|
+
|
|
51889
|
+
if (teamParticipant) {
|
|
51890
|
+
const individualParticipantIds = teamParticipant.individualParticipantIds.slice(i * 2, i * 2 + 2);
|
|
51891
|
+
individualParticipantIds.forEach(individualParticipantId => {
|
|
51892
|
+
const result = assignTieMatchUpParticipantId({
|
|
51893
|
+
participantId: individualParticipantId,
|
|
51894
|
+
tournamentRecord,
|
|
51895
|
+
drawDefinition,
|
|
51896
|
+
tieMatchUpId,
|
|
51897
|
+
event
|
|
51898
|
+
});
|
|
51899
|
+
if (!result.success) console.log(result);
|
|
51900
|
+
});
|
|
51901
|
+
}
|
|
51902
|
+
});
|
|
51903
|
+
});
|
|
51904
|
+
};
|
|
51905
|
+
|
|
51906
|
+
firstRoundDualMatchUps.forEach(assignParticipants);
|
|
51907
|
+
}
|
|
51908
|
+
} // to support legacy tests it is possible to use completeAllMatchUps
|
|
51659
51909
|
// to pass a score string that will be applied to all matchUps
|
|
51660
51910
|
|
|
51911
|
+
|
|
51661
51912
|
const scoreString = typeof completeAllMatchUps === 'string' && completeAllMatchUps;
|
|
51662
51913
|
const matchUpStatus = scoreString && COMPLETED;
|
|
51663
51914
|
|
|
51664
51915
|
for (const structure of sortedStructures) {
|
|
51665
|
-
const matchUpsMap = getMatchUpsMap({
|
|
51666
|
-
drawDefinition
|
|
51667
|
-
});
|
|
51668
51916
|
const {
|
|
51669
51917
|
matchUps
|
|
51670
51918
|
} = getAllStructureMatchUps({
|
|
51919
|
+
matchUpFilters: {
|
|
51920
|
+
matchUpTypes: [DOUBLES$1, SINGLES$1]
|
|
51921
|
+
},
|
|
51922
|
+
tournamentRecord,
|
|
51671
51923
|
inContext: true,
|
|
51672
51924
|
drawDefinition,
|
|
51673
51925
|
matchUpsMap,
|
|
@@ -51683,6 +51935,10 @@ function completeDrawMatchUps({
|
|
|
51683
51935
|
const {
|
|
51684
51936
|
matchUps
|
|
51685
51937
|
} = getAllStructureMatchUps({
|
|
51938
|
+
matchUpFilters: {
|
|
51939
|
+
matchUpTypes: [DOUBLES$1, SINGLES$1]
|
|
51940
|
+
},
|
|
51941
|
+
tournamentRecord,
|
|
51686
51942
|
inContext: true,
|
|
51687
51943
|
drawDefinition,
|
|
51688
51944
|
matchUpsMap,
|
|
@@ -51912,12 +52168,14 @@ function generateFlightDrawDefinitions({
|
|
|
51912
52168
|
if (!manual && (completeAllMatchUps || completionGoal)) {
|
|
51913
52169
|
const matchUpFormat = drawProfile === null || drawProfile === void 0 ? void 0 : drawProfile.matchUpFormat;
|
|
51914
52170
|
const result = completeDrawMatchUps({
|
|
51915
|
-
matchUpStatusProfile,
|
|
51916
52171
|
completeAllMatchUps: !completionGoal && completeAllMatchUps,
|
|
52172
|
+
matchUpStatusProfile,
|
|
51917
52173
|
randomWinningSide,
|
|
52174
|
+
tournamentRecord,
|
|
51918
52175
|
completionGoal,
|
|
51919
52176
|
drawDefinition,
|
|
51920
|
-
matchUpFormat
|
|
52177
|
+
matchUpFormat,
|
|
52178
|
+
event
|
|
51921
52179
|
});
|
|
51922
52180
|
if (result.error) return result;
|
|
51923
52181
|
const completedCount = result.completedCount;
|
|
@@ -51937,8 +52195,10 @@ function generateFlightDrawDefinitions({
|
|
|
51937
52195
|
completionGoal: completionGoal ? playoffCompletionGoal : undefined,
|
|
51938
52196
|
matchUpStatusProfile,
|
|
51939
52197
|
randomWinningSide,
|
|
52198
|
+
tournamentRecord,
|
|
51940
52199
|
drawDefinition,
|
|
51941
|
-
matchUpFormat
|
|
52200
|
+
matchUpFormat,
|
|
52201
|
+
event
|
|
51942
52202
|
});
|
|
51943
52203
|
if (result.error) return result;
|
|
51944
52204
|
}
|
|
@@ -52989,6 +53249,7 @@ function generateEventWithDraw({
|
|
|
52989
53249
|
const individualParticipantIds = allIndividualParticipantIds.slice(teamIndex * teamSize, (teamIndex + 1) * teamSize);
|
|
52990
53250
|
return {
|
|
52991
53251
|
participantName: `Team ${teamIndex + 1}`,
|
|
53252
|
+
participantOtherName: `TM${teamIndex + 1}`,
|
|
52992
53253
|
participantRole: COMPETITOR,
|
|
52993
53254
|
participantType: TEAM$1,
|
|
52994
53255
|
participantId: UUID(),
|
|
@@ -53143,6 +53404,45 @@ function generateEventWithDraw({
|
|
|
53143
53404
|
const manual = drawProfile.automated === false;
|
|
53144
53405
|
|
|
53145
53406
|
if (!manual) {
|
|
53407
|
+
if (completeAllMatchUps || completionGoal) {
|
|
53408
|
+
const result = completeDrawMatchUps({
|
|
53409
|
+
matchUpStatusProfile,
|
|
53410
|
+
completeAllMatchUps,
|
|
53411
|
+
randomWinningSide,
|
|
53412
|
+
tournamentRecord,
|
|
53413
|
+
completionGoal,
|
|
53414
|
+
drawDefinition,
|
|
53415
|
+
matchUpFormat,
|
|
53416
|
+
event
|
|
53417
|
+
});
|
|
53418
|
+
if (result.error) return result;
|
|
53419
|
+
const completedCount = result.completedCount;
|
|
53420
|
+
|
|
53421
|
+
if (drawType === ROUND_ROBIN_WITH_PLAYOFF) {
|
|
53422
|
+
const mainStructure = drawDefinition.structures.find(structure => structure.stage === MAIN);
|
|
53423
|
+
let result = automatedPlayoffPositioning({
|
|
53424
|
+
structureId: mainStructure.structureId,
|
|
53425
|
+
tournamentRecord,
|
|
53426
|
+
drawDefinition,
|
|
53427
|
+
event
|
|
53428
|
+
}); // ignore when positioning cannot occur because of incomplete source structure
|
|
53429
|
+
|
|
53430
|
+
const playoffCompletionGoal = completionGoal ? completionGoal - completedCount : undefined;
|
|
53431
|
+
result = completeDrawMatchUps({
|
|
53432
|
+
completionGoal: completionGoal ? playoffCompletionGoal : undefined,
|
|
53433
|
+
matchUpStatusProfile,
|
|
53434
|
+
completeAllMatchUps,
|
|
53435
|
+
randomWinningSide,
|
|
53436
|
+
tournamentRecord,
|
|
53437
|
+
drawDefinition,
|
|
53438
|
+
matchUpFormat,
|
|
53439
|
+
event
|
|
53440
|
+
});
|
|
53441
|
+
if (result.error) return result;
|
|
53442
|
+
} // TODO: check if RRWPO & automate & complete
|
|
53443
|
+
|
|
53444
|
+
}
|
|
53445
|
+
|
|
53146
53446
|
if (drawProfile.outcomes) {
|
|
53147
53447
|
const {
|
|
53148
53448
|
matchUps
|
|
@@ -53204,41 +53504,6 @@ function generateEventWithDraw({
|
|
|
53204
53504
|
if (result !== null && result !== void 0 && result.error) return result;
|
|
53205
53505
|
}
|
|
53206
53506
|
}
|
|
53207
|
-
|
|
53208
|
-
if (completeAllMatchUps || completionGoal) {
|
|
53209
|
-
const result = completeDrawMatchUps({
|
|
53210
|
-
matchUpStatusProfile,
|
|
53211
|
-
completeAllMatchUps,
|
|
53212
|
-
randomWinningSide,
|
|
53213
|
-
completionGoal,
|
|
53214
|
-
drawDefinition,
|
|
53215
|
-
matchUpFormat
|
|
53216
|
-
});
|
|
53217
|
-
if (result.error) return result;
|
|
53218
|
-
const completedCount = result.completedCount;
|
|
53219
|
-
|
|
53220
|
-
if (drawType === ROUND_ROBIN_WITH_PLAYOFF) {
|
|
53221
|
-
const mainStructure = drawDefinition.structures.find(structure => structure.stage === MAIN);
|
|
53222
|
-
let result = automatedPlayoffPositioning({
|
|
53223
|
-
structureId: mainStructure.structureId,
|
|
53224
|
-
tournamentRecord,
|
|
53225
|
-
drawDefinition,
|
|
53226
|
-
event
|
|
53227
|
-
}); // ignore when positioning cannot occur because of incomplete source structure
|
|
53228
|
-
|
|
53229
|
-
const playoffCompletionGoal = completionGoal ? completionGoal - completedCount : undefined;
|
|
53230
|
-
result = completeDrawMatchUps({
|
|
53231
|
-
completionGoal: completionGoal ? playoffCompletionGoal : undefined,
|
|
53232
|
-
matchUpStatusProfile,
|
|
53233
|
-
completeAllMatchUps,
|
|
53234
|
-
randomWinningSide,
|
|
53235
|
-
drawDefinition,
|
|
53236
|
-
matchUpFormat
|
|
53237
|
-
});
|
|
53238
|
-
if (result.error) return result;
|
|
53239
|
-
} // TODO: check if RRWPO & automate & complete
|
|
53240
|
-
|
|
53241
|
-
}
|
|
53242
53507
|
}
|
|
53243
53508
|
|
|
53244
53509
|
if (publish) {
|