tods-competition-factory 1.8.9 → 1.8.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 +25 -27
- package/dist/forge/generate.mjs.map +1 -1
- package/dist/forge/query.d.ts +8 -6
- package/dist/forge/query.mjs +256 -1229
- package/dist/forge/query.mjs.map +1 -1
- package/dist/forge/transform.mjs +2 -2
- package/dist/forge/transform.mjs.map +1 -1
- package/dist/forge/utilities.mjs.map +1 -1
- package/dist/index.mjs +1940 -1934
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +1927 -1925
- 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
|
@@ -695,10 +695,6 @@ const INVALID_SCALE_ITEM = {
|
|
|
695
695
|
message: "Invalid scaleItem",
|
|
696
696
|
code: "ERR_INVALID_SCALE_ITEM"
|
|
697
697
|
};
|
|
698
|
-
const SCALE_ITEM_NOT_FOUND = {
|
|
699
|
-
message: "No scaleItem found",
|
|
700
|
-
code: "ERR_NOT_FOUND_SCALE_ITEM"
|
|
701
|
-
};
|
|
702
698
|
const NO_CANDIDATES = {
|
|
703
699
|
message: "No Candidates",
|
|
704
700
|
code: "ERR_UNCHANGED_NO_CANDIDATES"
|
|
@@ -1383,7 +1379,7 @@ function getPolicyDefinitions({
|
|
|
1383
1379
|
if (policy)
|
|
1384
1380
|
policyDefinitions[policyType] = policy;
|
|
1385
1381
|
}
|
|
1386
|
-
return Object.keys(policyDefinitions).length ? { policyDefinitions } : {
|
|
1382
|
+
return Object.keys(policyDefinitions).length ? { policyDefinitions } : { info: POLICY_NOT_FOUND.message };
|
|
1387
1383
|
}
|
|
1388
1384
|
|
|
1389
1385
|
const WALKOVER = "WALKOVER";
|
|
@@ -1444,7 +1440,7 @@ function findPolicy({
|
|
|
1444
1440
|
structure,
|
|
1445
1441
|
event
|
|
1446
1442
|
});
|
|
1447
|
-
return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : {
|
|
1443
|
+
return appliedPolicies?.[policyType] ? { policy: appliedPolicies[policyType] } : { info: POLICY_NOT_FOUND?.message };
|
|
1448
1444
|
}
|
|
1449
1445
|
|
|
1450
1446
|
const POLICY_TYPE_COMPETITIVE_BANDS = "competitiveBands";
|
|
@@ -17936,7 +17932,7 @@ function participantScaleItem({
|
|
|
17936
17932
|
return { error: INVALID_VALUES };
|
|
17937
17933
|
if (!participant.timeItems)
|
|
17938
17934
|
participant.timeItems = [];
|
|
17939
|
-
if (
|
|
17935
|
+
if (Array.isArray(participant.timeItems)) {
|
|
17940
17936
|
const { accessor, scaleType, eventType, scaleName } = scaleAttributes;
|
|
17941
17937
|
const filterType = [SCALE, scaleType, eventType, scaleName].join(".");
|
|
17942
17938
|
const filteredTimeItems = participant.timeItems.filter((timeItem2) => timeItem2?.itemType === filterType).filter((timeItem2) => !requireTimeStamp || timeItem2?.itemDate).sort(
|
|
@@ -17956,12 +17952,10 @@ function participantScaleItem({
|
|
|
17956
17952
|
scaleName: scaleName2,
|
|
17957
17953
|
scaleType: scaleType2
|
|
17958
17954
|
};
|
|
17959
|
-
return { scaleItem };
|
|
17960
|
-
} else {
|
|
17961
|
-
return { error: SCALE_ITEM_NOT_FOUND };
|
|
17955
|
+
return { ...SUCCESS, scaleItem };
|
|
17962
17956
|
}
|
|
17963
17957
|
}
|
|
17964
|
-
return {
|
|
17958
|
+
return { ...SUCCESS, scaleItem: void 0 };
|
|
17965
17959
|
}
|
|
17966
17960
|
|
|
17967
17961
|
function getEventSeedAssignments({
|
|
@@ -18168,7 +18162,7 @@ function addStructureParticipation({
|
|
|
18168
18162
|
|
|
18169
18163
|
function processSides(params) {
|
|
18170
18164
|
const {
|
|
18171
|
-
|
|
18165
|
+
withScheduleItems,
|
|
18172
18166
|
scheduleAnalysis,
|
|
18173
18167
|
withTeamMatchUps,
|
|
18174
18168
|
participantMap,
|
|
@@ -18278,7 +18272,7 @@ function processSides(params) {
|
|
|
18278
18272
|
stage
|
|
18279
18273
|
});
|
|
18280
18274
|
}
|
|
18281
|
-
if (scheduleAnalysis ||
|
|
18275
|
+
if (scheduleAnalysis || withScheduleItems) {
|
|
18282
18276
|
addScheduleItem({
|
|
18283
18277
|
participantMap,
|
|
18284
18278
|
participantId: participantId2,
|
|
@@ -18424,7 +18418,6 @@ function getParticipantEntries(params) {
|
|
|
18424
18418
|
participantMap,
|
|
18425
18419
|
withPotentialMatchUps,
|
|
18426
18420
|
withRankingProfile,
|
|
18427
|
-
withScheduleTimes,
|
|
18428
18421
|
withScheduleItems,
|
|
18429
18422
|
scheduleAnalysis,
|
|
18430
18423
|
withTeamMatchUps,
|
|
@@ -18435,8 +18428,6 @@ function getParticipantEntries(params) {
|
|
|
18435
18428
|
withEvents,
|
|
18436
18429
|
withDraws
|
|
18437
18430
|
} = params;
|
|
18438
|
-
if (withScheduleItems)
|
|
18439
|
-
console.log({ withScheduleItems });
|
|
18440
18431
|
const targetParticipantIds = participantFilters?.participantIds;
|
|
18441
18432
|
const getRelevantParticipantIds = (participantId) => {
|
|
18442
18433
|
const relevantParticipantIds = [participantId];
|
|
@@ -18454,7 +18445,7 @@ function getParticipantEntries(params) {
|
|
|
18454
18445
|
withDraws: withDraws || withRankingProfile,
|
|
18455
18446
|
withPotentialMatchUps,
|
|
18456
18447
|
withRankingProfile,
|
|
18457
|
-
|
|
18448
|
+
withScheduleItems,
|
|
18458
18449
|
scheduleAnalysis,
|
|
18459
18450
|
withTeamMatchUps,
|
|
18460
18451
|
withStatistics,
|
|
@@ -18774,7 +18765,7 @@ function getParticipantEntries(params) {
|
|
|
18774
18765
|
matchUpType: matchUpType2
|
|
18775
18766
|
});
|
|
18776
18767
|
}
|
|
18777
|
-
if (Array.isArray(potentialParticipants) && (nextMatchUps || !!scheduleAnalysis ||
|
|
18768
|
+
if (Array.isArray(potentialParticipants) && (nextMatchUps || !!scheduleAnalysis || withScheduleItems)) {
|
|
18778
18769
|
const potentialParticipantIds = potentialParticipants.flat().map(extractAttributes("participantId")).filter(Boolean);
|
|
18779
18770
|
potentialParticipantIds?.forEach((participantId) => {
|
|
18780
18771
|
const relevantParticipantIds = getRelevantParticipantIds(participantId);
|
|
@@ -18789,7 +18780,7 @@ function getParticipantEntries(params) {
|
|
|
18789
18780
|
drawId
|
|
18790
18781
|
});
|
|
18791
18782
|
});
|
|
18792
|
-
if (!!scheduleAnalysis ||
|
|
18783
|
+
if (!!scheduleAnalysis || withScheduleItems) {
|
|
18793
18784
|
addScheduleItem({
|
|
18794
18785
|
potential: true,
|
|
18795
18786
|
participantMap,
|
|
@@ -18898,13 +18889,18 @@ function getParticipantEntries(params) {
|
|
|
18898
18889
|
const notBeforeTime = typeChange ? typeChangeTimeAfterRecovery || timeAfterRecovery : timeAfterRecovery;
|
|
18899
18890
|
const sameDraw = scheduleItem.drawId === consideredItem.drawId;
|
|
18900
18891
|
const bothPotential = potentialMatchUps[scheduleItem.matchUpId] && potentialMatchUps[consideredItem.matchUpId];
|
|
18901
|
-
const
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18892
|
+
const consideredMinutes = timeStringMinutes(
|
|
18893
|
+
consideredItem.scheduledTime
|
|
18894
|
+
);
|
|
18895
|
+
const minutesDifference = Math.abs(
|
|
18896
|
+
consideredMinutes - scheduledMinutes
|
|
18897
|
+
);
|
|
18898
|
+
const itemIsPrior = consideredMinutes > scheduledMinutes;
|
|
18899
|
+
const timeOverlap = scheduledMinutesDifference && !isNaN(scheduledMinutesDifference) ? minutesDifference <= scheduledMinutesDifference : itemIsPrior && timeStringMinutes(consideredItem.scheduledTime) < timeStringMinutes(notBeforeTime);
|
|
18900
|
+
if (timeOverlap && !(bothPotential && sameDraw) && itemIsPrior) {
|
|
18905
18901
|
participantAggregator.scheduleConflicts.push({
|
|
18906
|
-
priorScheduledMatchUpId:
|
|
18907
|
-
matchUpIdWithConflict:
|
|
18902
|
+
priorScheduledMatchUpId: scheduleItem.matchUpId,
|
|
18903
|
+
matchUpIdWithConflict: consideredItem.matchUpId
|
|
18908
18904
|
});
|
|
18909
18905
|
}
|
|
18910
18906
|
}
|
|
@@ -19120,6 +19116,7 @@ function getParticipants(params) {
|
|
|
19120
19116
|
({
|
|
19121
19117
|
potentialMatchUps,
|
|
19122
19118
|
scheduleConflicts,
|
|
19119
|
+
scheduleItems,
|
|
19123
19120
|
participant,
|
|
19124
19121
|
statistics,
|
|
19125
19122
|
opponents,
|
|
@@ -19145,7 +19142,8 @@ function getParticipants(params) {
|
|
|
19145
19142
|
matchUps: withMatchUps || withRankingProfile ? Object.values(matchUps2) : void 0,
|
|
19146
19143
|
opponents: withOpponents ? participantOpponents : void 0,
|
|
19147
19144
|
potentialMatchUps: nextMatchUps ? Object.values(potentialMatchUps) : void 0,
|
|
19148
|
-
statistics: withStatistics ? Object.values(statistics) : void 0
|
|
19145
|
+
statistics: withStatistics ? Object.values(statistics) : void 0,
|
|
19146
|
+
scheduleItems: withScheduleItems ? scheduleItems : void 0
|
|
19149
19147
|
},
|
|
19150
19148
|
false,
|
|
19151
19149
|
false,
|
|
@@ -23648,7 +23646,7 @@ function generateDrawDefinition(params) {
|
|
|
23648
23646
|
drawDefinition.links = [];
|
|
23649
23647
|
drawDefinition.links.push(link);
|
|
23650
23648
|
}
|
|
23651
|
-
drawDefinition.drawName = params.drawName ?? drawType;
|
|
23649
|
+
drawDefinition.drawName = params.drawName ?? (drawType && constantToString(drawType));
|
|
23652
23650
|
if (typeof voluntaryConsolation === "object") {
|
|
23653
23651
|
addVoluntaryConsolationStructure({
|
|
23654
23652
|
...voluntaryConsolation,
|