tods-competition-factory 2.0.49 → 2.0.50
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/index.mjs +5 -5
- package/dist/tods-competition-factory.d.ts +4 -1
- package/dist/tods-competition-factory.development.cjs.js +34 -19
- 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
|
@@ -2504,6 +2504,8 @@ type DrawMaticArgs = {
|
|
|
2504
2504
|
eventType?: EventTypeUnion;
|
|
2505
2505
|
salted?: number | boolean;
|
|
2506
2506
|
participantIds?: string[];
|
|
2507
|
+
dynamicRatings?: boolean;
|
|
2508
|
+
refreshDynamic?: boolean;
|
|
2507
2509
|
encounterValue?: number;
|
|
2508
2510
|
sameTeamValue?: number;
|
|
2509
2511
|
scaleAccessor?: string;
|
|
@@ -3616,6 +3618,7 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3616
3618
|
salted?: number | boolean;
|
|
3617
3619
|
participantIds?: string[];
|
|
3618
3620
|
dynamicRatings?: boolean;
|
|
3621
|
+
refreshDynamic?: boolean;
|
|
3619
3622
|
encounterValue?: number;
|
|
3620
3623
|
sameTeamValue?: number;
|
|
3621
3624
|
maxIterations?: number;
|
|
@@ -3643,7 +3646,7 @@ type DrawMaticRoundResult = {
|
|
|
3643
3646
|
maxDelta?: number;
|
|
3644
3647
|
maxDiff?: number;
|
|
3645
3648
|
};
|
|
3646
|
-
declare function generateDrawMaticRound({ encounterValue, sameTeamValue, maxIterations, updateParticipantRatings, generateMatchUps, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, participantIds, drawDefinition, adHocRatings, salted, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }: GenerateDrawMaticRoundArgs): ResultType & DrawMaticRoundResult;
|
|
3649
|
+
declare function generateDrawMaticRound({ encounterValue, sameTeamValue, maxIterations, updateParticipantRatings, generateMatchUps, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, refreshDynamic, participantIds, drawDefinition, adHocRatings, salted, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }: GenerateDrawMaticRoundArgs): ResultType & DrawMaticRoundResult;
|
|
3647
3650
|
|
|
3648
3651
|
type GenerateVoluntaryConsolationArgs = {
|
|
3649
3652
|
playoffAttributes?: PlayoffAttributes;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
function factoryVersion() {
|
|
6
|
-
return '2.0.
|
|
6
|
+
return '2.0.50';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -26505,6 +26505,7 @@ function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorV
|
|
|
26505
26505
|
if (result.error)
|
|
26506
26506
|
return result;
|
|
26507
26507
|
}
|
|
26508
|
+
return { ...SUCCESS };
|
|
26508
26509
|
}
|
|
26509
26510
|
|
|
26510
26511
|
function getParticipantScaleItem(params) {
|
|
@@ -26616,19 +26617,25 @@ const aggregateSets = (sets) => {
|
|
|
26616
26617
|
};
|
|
26617
26618
|
|
|
26618
26619
|
function generateDynamicRatings(params) {
|
|
26619
|
-
const
|
|
26620
|
-
|
|
26621
|
-
|
|
26622
|
-
|
|
26623
|
-
|
|
26624
|
-
if (
|
|
26625
|
-
return
|
|
26626
|
-
|
|
26627
|
-
return { error: INVALID_VALUES };
|
|
26620
|
+
const paramsCheck = checkRequiredParameters(params, [
|
|
26621
|
+
{ [TOURNAMENT_RECORD]: true },
|
|
26622
|
+
{ matchUpIds: true, [OF_TYPE]: ARRAY, [ERROR]: MISSING_MATCHUP_IDS },
|
|
26623
|
+
{ ratingType: false, [VALIDATE]: (value) => ratingsParameters[value] },
|
|
26624
|
+
]);
|
|
26625
|
+
if (paramsCheck.error)
|
|
26626
|
+
return paramsCheck;
|
|
26627
|
+
const { updateParticipantRatings, removePriorValues = true, tournamentRecord, ratingType = ELO, refreshDynamic, considerGames, drawDefinition, matchUpIds, asDynamic, } = params;
|
|
26628
26628
|
const ratingParameter = ratingsParameters[ratingType];
|
|
26629
26629
|
const { accessor } = ratingParameter;
|
|
26630
26630
|
const modifiedScaleValues = {};
|
|
26631
26631
|
const matchUps = params.matchUps ??
|
|
26632
|
+
(refreshDynamic &&
|
|
26633
|
+
allDrawMatchUps({
|
|
26634
|
+
drawDefinition,
|
|
26635
|
+
tournamentRecord,
|
|
26636
|
+
inContext: true,
|
|
26637
|
+
matchUpFilters: { matchUpStatuses: completedMatchUpStatuses },
|
|
26638
|
+
})) ??
|
|
26632
26639
|
allTournamentMatchUps({
|
|
26633
26640
|
matchUpFilters: { matchUpIds, matchUpStatuses: completedMatchUpStatuses },
|
|
26634
26641
|
tournamentRecord,
|
|
@@ -26662,16 +26669,20 @@ function generateDynamicRatings(params) {
|
|
|
26662
26669
|
const scaleItemMap = Object.assign({}, ...Object.values(sideParticipantIds)
|
|
26663
26670
|
.flat()
|
|
26664
26671
|
.map((participantId) => {
|
|
26665
|
-
const
|
|
26666
|
-
|
|
26667
|
-
|
|
26668
|
-
|
|
26669
|
-
|
|
26670
|
-
|
|
26672
|
+
const existingModifiedScaleValue = modifiedScaleValues[participantId];
|
|
26673
|
+
const useDynamic = !refreshDynamic || !existingModifiedScaleValue;
|
|
26674
|
+
const dynamicScaleItem = useDynamic
|
|
26675
|
+
? getParticipantScaleItem({
|
|
26676
|
+
scaleAttributes: dynamicScaleAttributes,
|
|
26677
|
+
tournamentRecord,
|
|
26678
|
+
participantId,
|
|
26679
|
+
}).scaleItem
|
|
26680
|
+
: undefined;
|
|
26681
|
+
const scaleItem = getParticipantScaleItem({
|
|
26671
26682
|
tournamentRecord,
|
|
26672
26683
|
scaleAttributes,
|
|
26673
26684
|
participantId,
|
|
26674
|
-
});
|
|
26685
|
+
}).scaleItem;
|
|
26675
26686
|
const scaleValue = accessor ? { [accessor]: undefined } : undefined;
|
|
26676
26687
|
return (participantId && {
|
|
26677
26688
|
[participantId]: dynamicScaleItem ??
|
|
@@ -27032,7 +27043,7 @@ function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairin
|
|
|
27032
27043
|
const ENCOUNTER_VALUE = 100;
|
|
27033
27044
|
const SAME_TEAM_VALUE = 100;
|
|
27034
27045
|
const MAX_ITERATIONS = 4000;
|
|
27035
|
-
function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValue = SAME_TEAM_VALUE, maxIterations = MAX_ITERATIONS, updateParticipantRatings, generateMatchUps = true, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, participantIds, drawDefinition, adHocRatings, salted = 0.5, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }) {
|
|
27046
|
+
function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValue = SAME_TEAM_VALUE, maxIterations = MAX_ITERATIONS, updateParticipantRatings, generateMatchUps = true, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, refreshDynamic, participantIds, drawDefinition, adHocRatings, salted = 0.5, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }) {
|
|
27036
27047
|
if (!drawDefinition)
|
|
27037
27048
|
return { error: MISSING_DRAW_DEFINITION };
|
|
27038
27049
|
if (!structure && !structureId)
|
|
@@ -27060,6 +27071,8 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27060
27071
|
updateParticipantRatings,
|
|
27061
27072
|
tournamentRecord,
|
|
27062
27073
|
asDynamic: true,
|
|
27074
|
+
refreshDynamic,
|
|
27075
|
+
drawDefinition,
|
|
27063
27076
|
matchUpIds,
|
|
27064
27077
|
});
|
|
27065
27078
|
if (result.error)
|
|
@@ -32242,7 +32255,7 @@ function drawMatic(params) {
|
|
|
32242
32255
|
const structureResult = getAdHocStructure(params);
|
|
32243
32256
|
if (structureResult.error)
|
|
32244
32257
|
return structureResult;
|
|
32245
|
-
|
|
32258
|
+
let adHocRatings = getAdHocRatings(params);
|
|
32246
32259
|
const isMock = params.tournamentRecord?.isMock ?? params.isMock;
|
|
32247
32260
|
const eventType = params.eventType ?? params.event?.eventType;
|
|
32248
32261
|
const matchUps = [];
|
|
@@ -32263,6 +32276,8 @@ function drawMatic(params) {
|
|
|
32263
32276
|
if (result.error)
|
|
32264
32277
|
return result;
|
|
32265
32278
|
const { matchUps: roundMatchUps, ...roundResult } = result;
|
|
32279
|
+
if (roundResult.modifiedScaleValues)
|
|
32280
|
+
adHocRatings = roundResult.modifiedScaleValues;
|
|
32266
32281
|
roundResults.push({ ...roundResult, iteration, matchUpsCount: roundMatchUps?.length });
|
|
32267
32282
|
roundNumber = (roundResult?.roundNumber ?? 1) + 1;
|
|
32268
32283
|
if (roundMatchUps?.length) {
|