tods-competition-factory 2.0.48 → 2.0.49
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 +16 -3
- package/dist/tods-competition-factory.development.cjs.js +59 -52
- 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 +1 -1
|
@@ -3605,6 +3605,7 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3605
3605
|
adHocRatings?: {
|
|
3606
3606
|
[key: string]: number;
|
|
3607
3607
|
};
|
|
3608
|
+
updateParticipantRatings?: boolean;
|
|
3608
3609
|
ignoreLastRoundNumber?: boolean;
|
|
3609
3610
|
restrictEntryStatus?: boolean;
|
|
3610
3611
|
iterationMatchUps?: MatchUp[];
|
|
@@ -3629,8 +3630,12 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3629
3630
|
event: Event$1;
|
|
3630
3631
|
};
|
|
3631
3632
|
type DrawMaticRoundResult = {
|
|
3633
|
+
modifiedScaleValues?: {
|
|
3634
|
+
[key: string]: number;
|
|
3635
|
+
};
|
|
3632
3636
|
participantIdPairings?: string[][];
|
|
3633
3637
|
candidatesCount?: number;
|
|
3638
|
+
outputScaleName?: string;
|
|
3634
3639
|
roundNumber?: number;
|
|
3635
3640
|
matchUps?: MatchUp[];
|
|
3636
3641
|
iterations?: number;
|
|
@@ -3638,7 +3643,7 @@ type DrawMaticRoundResult = {
|
|
|
3638
3643
|
maxDelta?: number;
|
|
3639
3644
|
maxDiff?: number;
|
|
3640
3645
|
};
|
|
3641
|
-
declare function generateDrawMaticRound({ encounterValue, sameTeamValue, maxIterations, generateMatchUps, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, participantIds, drawDefinition, adHocRatings, salted, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }: GenerateDrawMaticRoundArgs): ResultType & DrawMaticRoundResult;
|
|
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;
|
|
3642
3647
|
|
|
3643
3648
|
type GenerateVoluntaryConsolationArgs = {
|
|
3644
3649
|
playoffAttributes?: PlayoffAttributes;
|
|
@@ -6375,6 +6380,12 @@ declare function publicFindParticipant(params: PublicFindParticipantArgs): {
|
|
|
6375
6380
|
stack?: any;
|
|
6376
6381
|
};
|
|
6377
6382
|
|
|
6383
|
+
declare function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues }: {
|
|
6384
|
+
tournamentRecord: any;
|
|
6385
|
+
modifiedScaleValues: any;
|
|
6386
|
+
removePriorValues: any;
|
|
6387
|
+
}): any;
|
|
6388
|
+
|
|
6378
6389
|
type CreateGroupParticipantType = {
|
|
6379
6390
|
participantRoleResponsibilities?: string[];
|
|
6380
6391
|
individualParticipantIds: string[];
|
|
@@ -6582,6 +6593,7 @@ declare function removeParticipantIdsFromAllTeams({ participantRole, individualP
|
|
|
6582
6593
|
};
|
|
6583
6594
|
};
|
|
6584
6595
|
|
|
6596
|
+
declare const mutate$7_addDynamicRatings: typeof addDynamicRatings;
|
|
6585
6597
|
declare const mutate$7_addIndividualParticipantIds: typeof addIndividualParticipantIds;
|
|
6586
6598
|
declare const mutate$7_addParticipant: typeof addParticipant;
|
|
6587
6599
|
declare const mutate$7_addParticipants: typeof addParticipants;
|
|
@@ -6608,7 +6620,7 @@ declare const mutate$7_scaledTeamAssignment: typeof scaledTeamAssignment;
|
|
|
6608
6620
|
declare const mutate$7_setParticipantScaleItem: typeof setParticipantScaleItem;
|
|
6609
6621
|
declare const mutate$7_setParticipantScaleItems: typeof setParticipantScaleItems;
|
|
6610
6622
|
declare namespace mutate$7 {
|
|
6611
|
-
export { mutate$7_addIndividualParticipantIds as addIndividualParticipantIds, mutate$7_addParticipant as addParticipant, mutate$7_addParticipants as addParticipants, mutate$7_addPenalty as addPenalty, mutate$7_addPersonRequests as addPersonRequests, mutate$7_addPersons as addPersons, mutate$7_createGroupParticipant as createGroupParticipant, mutate$7_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, mutate$7_deleteParticipants as deleteParticipants, publicFindParticipant as findParticipant, mutate$7_mergeParticipants as mergeParticipants, mutate$7_modifyIndividualParticipantIds as modifyIndividualParticipantIds, mutate$7_modifyParticipant as modifyParticipant, mutate$7_modifyParticipantName as modifyParticipantName, mutate$7_modifyParticipantOtherName as modifyParticipantOtherName, mutate$7_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, mutate$7_modifyPenalty as modifyPenalty, mutate$7_modifyPersonRequests as modifyPersonRequests, mutate$7_regenerateParticipantNames as regenerateParticipantNames, mutate$7_removeIndividualParticipantIds as removeIndividualParticipantIds, mutate$7_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, mutate$7_removePenalty as removePenalty, mutate$7_removePersonRequests as removePersonRequests, mutate$7_scaledTeamAssignment as scaledTeamAssignment, mutate$7_setParticipantScaleItem as setParticipantScaleItem, mutate$7_setParticipantScaleItems as setParticipantScaleItems };
|
|
6623
|
+
export { mutate$7_addDynamicRatings as addDynamicRatings, mutate$7_addIndividualParticipantIds as addIndividualParticipantIds, mutate$7_addParticipant as addParticipant, mutate$7_addParticipants as addParticipants, mutate$7_addPenalty as addPenalty, mutate$7_addPersonRequests as addPersonRequests, mutate$7_addPersons as addPersons, mutate$7_createGroupParticipant as createGroupParticipant, mutate$7_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, mutate$7_deleteParticipants as deleteParticipants, publicFindParticipant as findParticipant, mutate$7_mergeParticipants as mergeParticipants, mutate$7_modifyIndividualParticipantIds as modifyIndividualParticipantIds, mutate$7_modifyParticipant as modifyParticipant, mutate$7_modifyParticipantName as modifyParticipantName, mutate$7_modifyParticipantOtherName as modifyParticipantOtherName, mutate$7_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, mutate$7_modifyPenalty as modifyPenalty, mutate$7_modifyPersonRequests as modifyPersonRequests, mutate$7_regenerateParticipantNames as regenerateParticipantNames, mutate$7_removeIndividualParticipantIds as removeIndividualParticipantIds, mutate$7_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, mutate$7_removePenalty as removePenalty, mutate$7_removePersonRequests as removePersonRequests, mutate$7_scaledTeamAssignment as scaledTeamAssignment, mutate$7_setParticipantScaleItem as setParticipantScaleItem, mutate$7_setParticipantScaleItems as setParticipantScaleItems };
|
|
6612
6624
|
}
|
|
6613
6625
|
|
|
6614
6626
|
declare function getCompetitionParticipants(params: any): ResultType & {
|
|
@@ -6806,6 +6818,7 @@ declare namespace query$7 {
|
|
|
6806
6818
|
export { query$7_filterParticipants as filterParticipants, query$7_getCompetitionParticipants as getCompetitionParticipants, query$7_getPairedParticipant as getPairedParticipant, query$7_getParticipantEventDetails as getParticipantEventDetails, query$7_getParticipantMembership as getParticipantMembership, query$7_getParticipantScaleItem as getParticipantScaleItem, query$7_getParticipantSchedules as getParticipantSchedules, query$7_getParticipantSignInStatus as getParticipantSignInStatus, query$7_getParticipantTimeItem as getParticipantTimeItem, query$7_getParticipants as getParticipants, query$7_getScaleValues as getScaleValues, query$7_participantScaleItem as participantScaleItem, query$7_validateLineUp as validateLineUp };
|
|
6807
6819
|
}
|
|
6808
6820
|
|
|
6821
|
+
declare const index$c_addDynamicRatings: typeof addDynamicRatings;
|
|
6809
6822
|
declare const index$c_addIndividualParticipantIds: typeof addIndividualParticipantIds;
|
|
6810
6823
|
declare const index$c_addParticipant: typeof addParticipant;
|
|
6811
6824
|
declare const index$c_addParticipants: typeof addParticipants;
|
|
@@ -6845,7 +6858,7 @@ declare const index$c_setParticipantScaleItem: typeof setParticipantScaleItem;
|
|
|
6845
6858
|
declare const index$c_setParticipantScaleItems: typeof setParticipantScaleItems;
|
|
6846
6859
|
declare const index$c_validateLineUp: typeof validateLineUp;
|
|
6847
6860
|
declare namespace index$c {
|
|
6848
|
-
export { index$c_addIndividualParticipantIds as addIndividualParticipantIds, index$c_addParticipant as addParticipant, index$c_addParticipants as addParticipants, index$c_addPenalty as addPenalty, index$c_addPersonRequests as addPersonRequests, index$c_addPersons as addPersons, index$c_createGroupParticipant as createGroupParticipant, index$c_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, index$c_deleteParticipants as deleteParticipants, index$c_filterParticipants as filterParticipants, publicFindParticipant as findParticipant, index$c_getCompetitionParticipants as getCompetitionParticipants, index$c_getPairedParticipant as getPairedParticipant, index$c_getParticipantEventDetails as getParticipantEventDetails, index$c_getParticipantMembership as getParticipantMembership, index$c_getParticipantScaleItem as getParticipantScaleItem, index$c_getParticipantSchedules as getParticipantSchedules, index$c_getParticipantSignInStatus as getParticipantSignInStatus, index$c_getParticipantTimeItem as getParticipantTimeItem, index$c_getParticipants as getParticipants, index$c_getScaleValues as getScaleValues, index$c_mergeParticipants as mergeParticipants, index$c_modifyIndividualParticipantIds as modifyIndividualParticipantIds, index$c_modifyParticipant as modifyParticipant, index$c_modifyParticipantName as modifyParticipantName, index$c_modifyParticipantOtherName as modifyParticipantOtherName, index$c_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, index$c_modifyPenalty as modifyPenalty, index$c_modifyPersonRequests as modifyPersonRequests, mutate$7 as mutate, index$c_participantScaleItem as participantScaleItem, query$7 as query, index$c_regenerateParticipantNames as regenerateParticipantNames, index$c_removeIndividualParticipantIds as removeIndividualParticipantIds, index$c_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, index$c_removePenalty as removePenalty, index$c_removePersonRequests as removePersonRequests, index$c_scaledTeamAssignment as scaledTeamAssignment, index$c_setParticipantScaleItem as setParticipantScaleItem, index$c_setParticipantScaleItems as setParticipantScaleItems, index$c_validateLineUp as validateLineUp };
|
|
6861
|
+
export { index$c_addDynamicRatings as addDynamicRatings, index$c_addIndividualParticipantIds as addIndividualParticipantIds, index$c_addParticipant as addParticipant, index$c_addParticipants as addParticipants, index$c_addPenalty as addPenalty, index$c_addPersonRequests as addPersonRequests, index$c_addPersons as addPersons, index$c_createGroupParticipant as createGroupParticipant, index$c_createTeamsFromParticipantAttributes as createTeamsFromParticipantAttributes, index$c_deleteParticipants as deleteParticipants, index$c_filterParticipants as filterParticipants, publicFindParticipant as findParticipant, index$c_getCompetitionParticipants as getCompetitionParticipants, index$c_getPairedParticipant as getPairedParticipant, index$c_getParticipantEventDetails as getParticipantEventDetails, index$c_getParticipantMembership as getParticipantMembership, index$c_getParticipantScaleItem as getParticipantScaleItem, index$c_getParticipantSchedules as getParticipantSchedules, index$c_getParticipantSignInStatus as getParticipantSignInStatus, index$c_getParticipantTimeItem as getParticipantTimeItem, index$c_getParticipants as getParticipants, index$c_getScaleValues as getScaleValues, index$c_mergeParticipants as mergeParticipants, index$c_modifyIndividualParticipantIds as modifyIndividualParticipantIds, index$c_modifyParticipant as modifyParticipant, index$c_modifyParticipantName as modifyParticipantName, index$c_modifyParticipantOtherName as modifyParticipantOtherName, index$c_modifyParticipantsSignInStatus as modifyParticipantsSignInStatus, index$c_modifyPenalty as modifyPenalty, index$c_modifyPersonRequests as modifyPersonRequests, mutate$7 as mutate, index$c_participantScaleItem as participantScaleItem, query$7 as query, index$c_regenerateParticipantNames as regenerateParticipantNames, index$c_removeIndividualParticipantIds as removeIndividualParticipantIds, index$c_removeParticipantIdsFromAllTeams as removeParticipantIdsFromAllTeams, index$c_removePenalty as removePenalty, index$c_removePersonRequests as removePersonRequests, index$c_scaledTeamAssignment as scaledTeamAssignment, index$c_setParticipantScaleItem as setParticipantScaleItem, index$c_setParticipantScaleItems as setParticipantScaleItems, index$c_validateLineUp as validateLineUp };
|
|
6849
6862
|
}
|
|
6850
6863
|
|
|
6851
6864
|
type AttachPoliciesArgs = {
|
|
@@ -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.49';
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
function isFunction(obj) {
|
|
@@ -26329,28 +26329,6 @@ function generateDrawTypeAndModifyDrawDefinition(params) {
|
|
|
26329
26329
|
};
|
|
26330
26330
|
}
|
|
26331
26331
|
|
|
26332
|
-
function getParticipantScaleItem(params) {
|
|
26333
|
-
const { tournamentRecord, scaleAttributes, participantId } = params;
|
|
26334
|
-
const tournamentRecords = params.tournamentRecords ||
|
|
26335
|
-
(tournamentRecord && {
|
|
26336
|
-
[tournamentRecord.tournamentId]: tournamentRecord,
|
|
26337
|
-
}) ||
|
|
26338
|
-
{};
|
|
26339
|
-
if (!participantId)
|
|
26340
|
-
return { error: MISSING_PARTICIPANT_ID };
|
|
26341
|
-
const { participant, tournamentId } = findTournamentParticipant({
|
|
26342
|
-
tournamentRecords,
|
|
26343
|
-
tournamentRecord,
|
|
26344
|
-
participantId,
|
|
26345
|
-
});
|
|
26346
|
-
if (!participant)
|
|
26347
|
-
return { error: PARTICIPANT_NOT_FOUND };
|
|
26348
|
-
return {
|
|
26349
|
-
...participantScaleItem({ participant, scaleAttributes }),
|
|
26350
|
-
tournamentId,
|
|
26351
|
-
};
|
|
26352
|
-
}
|
|
26353
|
-
|
|
26354
26332
|
function setParticipantScaleItem(params) {
|
|
26355
26333
|
const { removePriorValues, tournamentRecord, participantId, scaleItem } = params;
|
|
26356
26334
|
let equivalentValue, participant;
|
|
@@ -26514,6 +26492,43 @@ function addParticipantScaleItem({ removePriorValues, participant, scaleItem })
|
|
|
26514
26492
|
return { ...SUCCESS, valueChanged, newValue: scaleItem.scaleValue };
|
|
26515
26493
|
}
|
|
26516
26494
|
|
|
26495
|
+
function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues }) {
|
|
26496
|
+
if (!tournamentRecord)
|
|
26497
|
+
return { error: MISSING_TOURNAMENT_RECORD };
|
|
26498
|
+
for (const participantId in modifiedScaleValues) {
|
|
26499
|
+
const result = setParticipantScaleItem({
|
|
26500
|
+
scaleItem: modifiedScaleValues[participantId],
|
|
26501
|
+
removePriorValues,
|
|
26502
|
+
tournamentRecord,
|
|
26503
|
+
participantId,
|
|
26504
|
+
});
|
|
26505
|
+
if (result.error)
|
|
26506
|
+
return result;
|
|
26507
|
+
}
|
|
26508
|
+
}
|
|
26509
|
+
|
|
26510
|
+
function getParticipantScaleItem(params) {
|
|
26511
|
+
const { tournamentRecord, scaleAttributes, participantId } = params;
|
|
26512
|
+
const tournamentRecords = params.tournamentRecords ||
|
|
26513
|
+
(tournamentRecord && {
|
|
26514
|
+
[tournamentRecord.tournamentId]: tournamentRecord,
|
|
26515
|
+
}) ||
|
|
26516
|
+
{};
|
|
26517
|
+
if (!participantId)
|
|
26518
|
+
return { error: MISSING_PARTICIPANT_ID };
|
|
26519
|
+
const { participant, tournamentId } = findTournamentParticipant({
|
|
26520
|
+
tournamentRecords,
|
|
26521
|
+
tournamentRecord,
|
|
26522
|
+
participantId,
|
|
26523
|
+
});
|
|
26524
|
+
if (!participant)
|
|
26525
|
+
return { error: PARTICIPANT_NOT_FOUND };
|
|
26526
|
+
return {
|
|
26527
|
+
...participantScaleItem({ participant, scaleAttributes }),
|
|
26528
|
+
tournamentId,
|
|
26529
|
+
};
|
|
26530
|
+
}
|
|
26531
|
+
|
|
26517
26532
|
const k538 = (countables = 0) => 250 / Math.pow(countables + 5, 0.4);
|
|
26518
26533
|
const kDefault = () => 1;
|
|
26519
26534
|
function kSet(maxCountables = 3, counted = 2) {
|
|
@@ -26601,7 +26616,7 @@ const aggregateSets = (sets) => {
|
|
|
26601
26616
|
};
|
|
26602
26617
|
|
|
26603
26618
|
function generateDynamicRatings(params) {
|
|
26604
|
-
const { removePriorValues = true, tournamentRecord, ratingType = ELO, considerGames, matchUpIds, asDynamic } = params;
|
|
26619
|
+
const { updateParticipantRatings, removePriorValues = true, tournamentRecord, ratingType = ELO, considerGames, matchUpIds, asDynamic, } = params;
|
|
26605
26620
|
if (!tournamentRecord)
|
|
26606
26621
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
26607
26622
|
if (!Array.isArray(matchUpIds))
|
|
@@ -26620,6 +26635,8 @@ function generateDynamicRatings(params) {
|
|
|
26620
26635
|
inContext: true,
|
|
26621
26636
|
}).matchUps ??
|
|
26622
26637
|
[];
|
|
26638
|
+
const dynamicScaleName = `${ratingType}.${DYNAMIC}`;
|
|
26639
|
+
const outputScaleName = asDynamic ? dynamicScaleName : ratingType;
|
|
26623
26640
|
matchUps.sort(matchUpSort);
|
|
26624
26641
|
for (const matchUp of matchUps) {
|
|
26625
26642
|
const { endDate, matchUpFormat, score, sides, winningSide } = matchUp;
|
|
@@ -26629,7 +26646,6 @@ function generateDynamicRatings(params) {
|
|
|
26629
26646
|
scaleName: ratingType,
|
|
26630
26647
|
scaleType: RATING$1,
|
|
26631
26648
|
};
|
|
26632
|
-
const dynamicScaleName = `${ratingType}.${DYNAMIC}`;
|
|
26633
26649
|
const dynamicScaleAttributes = {
|
|
26634
26650
|
scaleName: dynamicScaleName,
|
|
26635
26651
|
eventType: matchUpType,
|
|
@@ -26643,7 +26659,6 @@ function generateDynamicRatings(params) {
|
|
|
26643
26659
|
.flat(),
|
|
26644
26660
|
});
|
|
26645
26661
|
}));
|
|
26646
|
-
const outputScaleName = asDynamic ? dynamicScaleName : ratingType;
|
|
26647
26662
|
const scaleItemMap = Object.assign({}, ...Object.values(sideParticipantIds)
|
|
26648
26663
|
.flat()
|
|
26649
26664
|
.map((participantId) => {
|
|
@@ -26706,34 +26721,17 @@ function generateDynamicRatings(params) {
|
|
|
26706
26721
|
: newLoserRating;
|
|
26707
26722
|
scaleItemMap[winnerParticipantId].scaleValue = newWinnerScaleValue;
|
|
26708
26723
|
scaleItemMap[loserParticipantId].scaleValue = newLoserScaleValue;
|
|
26709
|
-
|
|
26710
|
-
|
|
26711
|
-
removePriorValues,
|
|
26712
|
-
tournamentRecord,
|
|
26713
|
-
scaleItem: {
|
|
26714
|
-
...scaleItemMap[winnerParticipantId],
|
|
26715
|
-
scaleName: outputScaleName,
|
|
26716
|
-
},
|
|
26717
|
-
});
|
|
26718
|
-
if (result.error)
|
|
26719
|
-
return result;
|
|
26720
|
-
result = setParticipantScaleItem({
|
|
26721
|
-
participantId: loserParticipantId,
|
|
26722
|
-
removePriorValues,
|
|
26723
|
-
tournamentRecord,
|
|
26724
|
-
scaleItem: {
|
|
26725
|
-
...scaleItemMap[loserParticipantId],
|
|
26726
|
-
scaleName: outputScaleName,
|
|
26727
|
-
},
|
|
26728
|
-
});
|
|
26729
|
-
if (result.error)
|
|
26730
|
-
return result;
|
|
26724
|
+
scaleItemMap[winnerParticipantId].scaleName = outputScaleName;
|
|
26725
|
+
scaleItemMap[loserParticipantId].scaleName = outputScaleName;
|
|
26731
26726
|
}
|
|
26732
26727
|
}
|
|
26733
26728
|
Object.assign(modifiedScaleValues, scaleItemMap);
|
|
26729
|
+
if (updateParticipantRatings) {
|
|
26730
|
+
addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues });
|
|
26731
|
+
}
|
|
26734
26732
|
}
|
|
26735
26733
|
const processedMatchUpIds = matchUps.map(({ matchUpId }) => matchUpId);
|
|
26736
|
-
return { ...SUCCESS, modifiedScaleValues, processedMatchUpIds };
|
|
26734
|
+
return { ...SUCCESS, modifiedScaleValues, outputScaleName, processedMatchUpIds };
|
|
26737
26735
|
}
|
|
26738
26736
|
|
|
26739
26737
|
function generateAdHocMatchUps(params) {
|
|
@@ -27034,7 +27032,7 @@ function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairin
|
|
|
27034
27032
|
const ENCOUNTER_VALUE = 100;
|
|
27035
27033
|
const SAME_TEAM_VALUE = 100;
|
|
27036
27034
|
const MAX_ITERATIONS = 4000;
|
|
27037
|
-
function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValue = SAME_TEAM_VALUE, maxIterations = MAX_ITERATIONS, generateMatchUps = true, ignoreLastRoundNumber, iterationMatchUps, tournamentRecord, dynamicRatings, participantIds, drawDefinition, adHocRatings, salted = 0.5, roundNumber, structureId, matchUpIds, eventType, structure, scaleName, idPrefix, isMock, event, }) {
|
|
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, }) {
|
|
27038
27036
|
if (!drawDefinition)
|
|
27039
27037
|
return { error: MISSING_DRAW_DEFINITION };
|
|
27040
27038
|
if (!structure && !structureId)
|
|
@@ -27049,6 +27047,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27049
27047
|
const consideredMatchUps = [...(iterationMatchUps ?? []), ...(structure?.matchUps ?? [])];
|
|
27050
27048
|
const { encounters } = getEncounters({ matchUps: consideredMatchUps });
|
|
27051
27049
|
const tournamentParticipants = tournamentRecord?.participants ?? [];
|
|
27050
|
+
let modifiedScaleValues = {};
|
|
27052
27051
|
if (dynamicRatings) {
|
|
27053
27052
|
const roundNumbers = unique(structure?.matchUps ? structure.matchUps.map(({ roundNumber }) => roundNumber) : []);
|
|
27054
27053
|
const lastRoundNumber = Math.max(...roundNumbers, 0);
|
|
@@ -27056,12 +27055,17 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27056
27055
|
const matchUpIds = structure?.matchUps
|
|
27057
27056
|
?.filter(({ roundNumber }) => roundNumber === lastRoundNumber)
|
|
27058
27057
|
.map(({ matchUpId }) => matchUpId);
|
|
27059
|
-
generateDynamicRatings({
|
|
27058
|
+
const result = generateDynamicRatings({
|
|
27060
27059
|
ratingType: scaleName || event?.category?.ratingType,
|
|
27060
|
+
updateParticipantRatings,
|
|
27061
27061
|
tournamentRecord,
|
|
27062
27062
|
asDynamic: true,
|
|
27063
27063
|
matchUpIds,
|
|
27064
27064
|
});
|
|
27065
|
+
if (result.error)
|
|
27066
|
+
return result;
|
|
27067
|
+
if (result.modifiedScaleValues)
|
|
27068
|
+
modifiedScaleValues = result.modifiedScaleValues;
|
|
27065
27069
|
}
|
|
27066
27070
|
}
|
|
27067
27071
|
const { valueObjects } = getValueObjects({
|
|
@@ -27074,13 +27078,13 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27074
27078
|
participantIds,
|
|
27075
27079
|
});
|
|
27076
27080
|
const params = {
|
|
27081
|
+
adHocRatings: modifiedScaleValues || adHocRatings,
|
|
27077
27082
|
tournamentParticipants,
|
|
27078
27083
|
possiblePairings,
|
|
27079
27084
|
drawDefinition,
|
|
27080
27085
|
participantIds,
|
|
27081
27086
|
uniquePairings,
|
|
27082
27087
|
maxIterations,
|
|
27083
|
-
adHocRatings,
|
|
27084
27088
|
deltaObjects,
|
|
27085
27089
|
valueObjects,
|
|
27086
27090
|
eventType,
|
|
@@ -27115,6 +27119,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27115
27119
|
return {
|
|
27116
27120
|
roundNumber: generatedRoundNumber,
|
|
27117
27121
|
participantIdPairings,
|
|
27122
|
+
modifiedScaleValues,
|
|
27118
27123
|
candidatesCount,
|
|
27119
27124
|
...SUCCESS,
|
|
27120
27125
|
iterations,
|
|
@@ -51375,6 +51380,7 @@ function addPersons({ participantRole = COMPETITOR, tournamentRecord, persons })
|
|
|
51375
51380
|
|
|
51376
51381
|
var mutate$5 = {
|
|
51377
51382
|
__proto__: null,
|
|
51383
|
+
addDynamicRatings: addDynamicRatings,
|
|
51378
51384
|
addIndividualParticipantIds: addIndividualParticipantIds,
|
|
51379
51385
|
addParticipant: addParticipant,
|
|
51380
51386
|
addParticipants: addParticipants,
|
|
@@ -51405,6 +51411,7 @@ var mutate$5 = {
|
|
|
51405
51411
|
|
|
51406
51412
|
var index$8 = {
|
|
51407
51413
|
__proto__: null,
|
|
51414
|
+
addDynamicRatings: addDynamicRatings,
|
|
51408
51415
|
addIndividualParticipantIds: addIndividualParticipantIds,
|
|
51409
51416
|
addParticipant: addParticipant,
|
|
51410
51417
|
addParticipants: addParticipants,
|