tods-competition-factory 2.0.48 → 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 +19 -3
- package/dist/tods-competition-factory.development.cjs.js +90 -68
- 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;
|
|
@@ -3605,6 +3607,7 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3605
3607
|
adHocRatings?: {
|
|
3606
3608
|
[key: string]: number;
|
|
3607
3609
|
};
|
|
3610
|
+
updateParticipantRatings?: boolean;
|
|
3608
3611
|
ignoreLastRoundNumber?: boolean;
|
|
3609
3612
|
restrictEntryStatus?: boolean;
|
|
3610
3613
|
iterationMatchUps?: MatchUp[];
|
|
@@ -3615,6 +3618,7 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3615
3618
|
salted?: number | boolean;
|
|
3616
3619
|
participantIds?: string[];
|
|
3617
3620
|
dynamicRatings?: boolean;
|
|
3621
|
+
refreshDynamic?: boolean;
|
|
3618
3622
|
encounterValue?: number;
|
|
3619
3623
|
sameTeamValue?: number;
|
|
3620
3624
|
maxIterations?: number;
|
|
@@ -3629,8 +3633,12 @@ type GenerateDrawMaticRoundArgs = {
|
|
|
3629
3633
|
event: Event$1;
|
|
3630
3634
|
};
|
|
3631
3635
|
type DrawMaticRoundResult = {
|
|
3636
|
+
modifiedScaleValues?: {
|
|
3637
|
+
[key: string]: number;
|
|
3638
|
+
};
|
|
3632
3639
|
participantIdPairings?: string[][];
|
|
3633
3640
|
candidatesCount?: number;
|
|
3641
|
+
outputScaleName?: string;
|
|
3634
3642
|
roundNumber?: number;
|
|
3635
3643
|
matchUps?: MatchUp[];
|
|
3636
3644
|
iterations?: number;
|
|
@@ -3638,7 +3646,7 @@ type DrawMaticRoundResult = {
|
|
|
3638
3646
|
maxDelta?: number;
|
|
3639
3647
|
maxDiff?: number;
|
|
3640
3648
|
};
|
|
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;
|
|
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;
|
|
3642
3650
|
|
|
3643
3651
|
type GenerateVoluntaryConsolationArgs = {
|
|
3644
3652
|
playoffAttributes?: PlayoffAttributes;
|
|
@@ -6375,6 +6383,12 @@ declare function publicFindParticipant(params: PublicFindParticipantArgs): {
|
|
|
6375
6383
|
stack?: any;
|
|
6376
6384
|
};
|
|
6377
6385
|
|
|
6386
|
+
declare function addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues }: {
|
|
6387
|
+
tournamentRecord: any;
|
|
6388
|
+
modifiedScaleValues: any;
|
|
6389
|
+
removePriorValues: any;
|
|
6390
|
+
}): any;
|
|
6391
|
+
|
|
6378
6392
|
type CreateGroupParticipantType = {
|
|
6379
6393
|
participantRoleResponsibilities?: string[];
|
|
6380
6394
|
individualParticipantIds: string[];
|
|
@@ -6582,6 +6596,7 @@ declare function removeParticipantIdsFromAllTeams({ participantRole, individualP
|
|
|
6582
6596
|
};
|
|
6583
6597
|
};
|
|
6584
6598
|
|
|
6599
|
+
declare const mutate$7_addDynamicRatings: typeof addDynamicRatings;
|
|
6585
6600
|
declare const mutate$7_addIndividualParticipantIds: typeof addIndividualParticipantIds;
|
|
6586
6601
|
declare const mutate$7_addParticipant: typeof addParticipant;
|
|
6587
6602
|
declare const mutate$7_addParticipants: typeof addParticipants;
|
|
@@ -6608,7 +6623,7 @@ declare const mutate$7_scaledTeamAssignment: typeof scaledTeamAssignment;
|
|
|
6608
6623
|
declare const mutate$7_setParticipantScaleItem: typeof setParticipantScaleItem;
|
|
6609
6624
|
declare const mutate$7_setParticipantScaleItems: typeof setParticipantScaleItems;
|
|
6610
6625
|
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 };
|
|
6626
|
+
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
6627
|
}
|
|
6613
6628
|
|
|
6614
6629
|
declare function getCompetitionParticipants(params: any): ResultType & {
|
|
@@ -6806,6 +6821,7 @@ declare namespace query$7 {
|
|
|
6806
6821
|
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
6822
|
}
|
|
6808
6823
|
|
|
6824
|
+
declare const index$c_addDynamicRatings: typeof addDynamicRatings;
|
|
6809
6825
|
declare const index$c_addIndividualParticipantIds: typeof addIndividualParticipantIds;
|
|
6810
6826
|
declare const index$c_addParticipant: typeof addParticipant;
|
|
6811
6827
|
declare const index$c_addParticipants: typeof addParticipants;
|
|
@@ -6845,7 +6861,7 @@ declare const index$c_setParticipantScaleItem: typeof setParticipantScaleItem;
|
|
|
6845
6861
|
declare const index$c_setParticipantScaleItems: typeof setParticipantScaleItems;
|
|
6846
6862
|
declare const index$c_validateLineUp: typeof validateLineUp;
|
|
6847
6863
|
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 };
|
|
6864
|
+
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
6865
|
}
|
|
6850
6866
|
|
|
6851
6867
|
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.50';
|
|
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,44 @@ 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
|
+
return { ...SUCCESS };
|
|
26509
|
+
}
|
|
26510
|
+
|
|
26511
|
+
function getParticipantScaleItem(params) {
|
|
26512
|
+
const { tournamentRecord, scaleAttributes, participantId } = params;
|
|
26513
|
+
const tournamentRecords = params.tournamentRecords ||
|
|
26514
|
+
(tournamentRecord && {
|
|
26515
|
+
[tournamentRecord.tournamentId]: tournamentRecord,
|
|
26516
|
+
}) ||
|
|
26517
|
+
{};
|
|
26518
|
+
if (!participantId)
|
|
26519
|
+
return { error: MISSING_PARTICIPANT_ID };
|
|
26520
|
+
const { participant, tournamentId } = findTournamentParticipant({
|
|
26521
|
+
tournamentRecords,
|
|
26522
|
+
tournamentRecord,
|
|
26523
|
+
participantId,
|
|
26524
|
+
});
|
|
26525
|
+
if (!participant)
|
|
26526
|
+
return { error: PARTICIPANT_NOT_FOUND };
|
|
26527
|
+
return {
|
|
26528
|
+
...participantScaleItem({ participant, scaleAttributes }),
|
|
26529
|
+
tournamentId,
|
|
26530
|
+
};
|
|
26531
|
+
}
|
|
26532
|
+
|
|
26517
26533
|
const k538 = (countables = 0) => 250 / Math.pow(countables + 5, 0.4);
|
|
26518
26534
|
const kDefault = () => 1;
|
|
26519
26535
|
function kSet(maxCountables = 3, counted = 2) {
|
|
@@ -26601,25 +26617,33 @@ const aggregateSets = (sets) => {
|
|
|
26601
26617
|
};
|
|
26602
26618
|
|
|
26603
26619
|
function generateDynamicRatings(params) {
|
|
26604
|
-
const
|
|
26605
|
-
|
|
26606
|
-
|
|
26607
|
-
|
|
26608
|
-
|
|
26609
|
-
if (
|
|
26610
|
-
return
|
|
26611
|
-
|
|
26612
|
-
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;
|
|
26613
26628
|
const ratingParameter = ratingsParameters[ratingType];
|
|
26614
26629
|
const { accessor } = ratingParameter;
|
|
26615
26630
|
const modifiedScaleValues = {};
|
|
26616
26631
|
const matchUps = params.matchUps ??
|
|
26632
|
+
(refreshDynamic &&
|
|
26633
|
+
allDrawMatchUps({
|
|
26634
|
+
drawDefinition,
|
|
26635
|
+
tournamentRecord,
|
|
26636
|
+
inContext: true,
|
|
26637
|
+
matchUpFilters: { matchUpStatuses: completedMatchUpStatuses },
|
|
26638
|
+
})) ??
|
|
26617
26639
|
allTournamentMatchUps({
|
|
26618
26640
|
matchUpFilters: { matchUpIds, matchUpStatuses: completedMatchUpStatuses },
|
|
26619
26641
|
tournamentRecord,
|
|
26620
26642
|
inContext: true,
|
|
26621
26643
|
}).matchUps ??
|
|
26622
26644
|
[];
|
|
26645
|
+
const dynamicScaleName = `${ratingType}.${DYNAMIC}`;
|
|
26646
|
+
const outputScaleName = asDynamic ? dynamicScaleName : ratingType;
|
|
26623
26647
|
matchUps.sort(matchUpSort);
|
|
26624
26648
|
for (const matchUp of matchUps) {
|
|
26625
26649
|
const { endDate, matchUpFormat, score, sides, winningSide } = matchUp;
|
|
@@ -26629,7 +26653,6 @@ function generateDynamicRatings(params) {
|
|
|
26629
26653
|
scaleName: ratingType,
|
|
26630
26654
|
scaleType: RATING$1,
|
|
26631
26655
|
};
|
|
26632
|
-
const dynamicScaleName = `${ratingType}.${DYNAMIC}`;
|
|
26633
26656
|
const dynamicScaleAttributes = {
|
|
26634
26657
|
scaleName: dynamicScaleName,
|
|
26635
26658
|
eventType: matchUpType,
|
|
@@ -26643,20 +26666,23 @@ function generateDynamicRatings(params) {
|
|
|
26643
26666
|
.flat(),
|
|
26644
26667
|
});
|
|
26645
26668
|
}));
|
|
26646
|
-
const outputScaleName = asDynamic ? dynamicScaleName : ratingType;
|
|
26647
26669
|
const scaleItemMap = Object.assign({}, ...Object.values(sideParticipantIds)
|
|
26648
26670
|
.flat()
|
|
26649
26671
|
.map((participantId) => {
|
|
26650
|
-
const
|
|
26651
|
-
|
|
26652
|
-
|
|
26653
|
-
|
|
26654
|
-
|
|
26655
|
-
|
|
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({
|
|
26656
26682
|
tournamentRecord,
|
|
26657
26683
|
scaleAttributes,
|
|
26658
26684
|
participantId,
|
|
26659
|
-
});
|
|
26685
|
+
}).scaleItem;
|
|
26660
26686
|
const scaleValue = accessor ? { [accessor]: undefined } : undefined;
|
|
26661
26687
|
return (participantId && {
|
|
26662
26688
|
[participantId]: dynamicScaleItem ??
|
|
@@ -26706,34 +26732,17 @@ function generateDynamicRatings(params) {
|
|
|
26706
26732
|
: newLoserRating;
|
|
26707
26733
|
scaleItemMap[winnerParticipantId].scaleValue = newWinnerScaleValue;
|
|
26708
26734
|
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;
|
|
26735
|
+
scaleItemMap[winnerParticipantId].scaleName = outputScaleName;
|
|
26736
|
+
scaleItemMap[loserParticipantId].scaleName = outputScaleName;
|
|
26731
26737
|
}
|
|
26732
26738
|
}
|
|
26733
26739
|
Object.assign(modifiedScaleValues, scaleItemMap);
|
|
26740
|
+
if (updateParticipantRatings) {
|
|
26741
|
+
addDynamicRatings({ tournamentRecord, modifiedScaleValues, removePriorValues });
|
|
26742
|
+
}
|
|
26734
26743
|
}
|
|
26735
26744
|
const processedMatchUpIds = matchUps.map(({ matchUpId }) => matchUpId);
|
|
26736
|
-
return { ...SUCCESS, modifiedScaleValues, processedMatchUpIds };
|
|
26745
|
+
return { ...SUCCESS, modifiedScaleValues, outputScaleName, processedMatchUpIds };
|
|
26737
26746
|
}
|
|
26738
26747
|
|
|
26739
26748
|
function generateAdHocMatchUps(params) {
|
|
@@ -27034,7 +27043,7 @@ function getPairings({ tournamentParticipants, adHocRatings = {}, possiblePairin
|
|
|
27034
27043
|
const ENCOUNTER_VALUE = 100;
|
|
27035
27044
|
const SAME_TEAM_VALUE = 100;
|
|
27036
27045
|
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, }) {
|
|
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, }) {
|
|
27038
27047
|
if (!drawDefinition)
|
|
27039
27048
|
return { error: MISSING_DRAW_DEFINITION };
|
|
27040
27049
|
if (!structure && !structureId)
|
|
@@ -27049,6 +27058,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27049
27058
|
const consideredMatchUps = [...(iterationMatchUps ?? []), ...(structure?.matchUps ?? [])];
|
|
27050
27059
|
const { encounters } = getEncounters({ matchUps: consideredMatchUps });
|
|
27051
27060
|
const tournamentParticipants = tournamentRecord?.participants ?? [];
|
|
27061
|
+
let modifiedScaleValues = {};
|
|
27052
27062
|
if (dynamicRatings) {
|
|
27053
27063
|
const roundNumbers = unique(structure?.matchUps ? structure.matchUps.map(({ roundNumber }) => roundNumber) : []);
|
|
27054
27064
|
const lastRoundNumber = Math.max(...roundNumbers, 0);
|
|
@@ -27056,12 +27066,19 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27056
27066
|
const matchUpIds = structure?.matchUps
|
|
27057
27067
|
?.filter(({ roundNumber }) => roundNumber === lastRoundNumber)
|
|
27058
27068
|
.map(({ matchUpId }) => matchUpId);
|
|
27059
|
-
generateDynamicRatings({
|
|
27069
|
+
const result = generateDynamicRatings({
|
|
27060
27070
|
ratingType: scaleName || event?.category?.ratingType,
|
|
27071
|
+
updateParticipantRatings,
|
|
27061
27072
|
tournamentRecord,
|
|
27062
27073
|
asDynamic: true,
|
|
27074
|
+
refreshDynamic,
|
|
27075
|
+
drawDefinition,
|
|
27063
27076
|
matchUpIds,
|
|
27064
27077
|
});
|
|
27078
|
+
if (result.error)
|
|
27079
|
+
return result;
|
|
27080
|
+
if (result.modifiedScaleValues)
|
|
27081
|
+
modifiedScaleValues = result.modifiedScaleValues;
|
|
27065
27082
|
}
|
|
27066
27083
|
}
|
|
27067
27084
|
const { valueObjects } = getValueObjects({
|
|
@@ -27074,13 +27091,13 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27074
27091
|
participantIds,
|
|
27075
27092
|
});
|
|
27076
27093
|
const params = {
|
|
27094
|
+
adHocRatings: modifiedScaleValues || adHocRatings,
|
|
27077
27095
|
tournamentParticipants,
|
|
27078
27096
|
possiblePairings,
|
|
27079
27097
|
drawDefinition,
|
|
27080
27098
|
participantIds,
|
|
27081
27099
|
uniquePairings,
|
|
27082
27100
|
maxIterations,
|
|
27083
|
-
adHocRatings,
|
|
27084
27101
|
deltaObjects,
|
|
27085
27102
|
valueObjects,
|
|
27086
27103
|
eventType,
|
|
@@ -27115,6 +27132,7 @@ function generateDrawMaticRound({ encounterValue = ENCOUNTER_VALUE, sameTeamValu
|
|
|
27115
27132
|
return {
|
|
27116
27133
|
roundNumber: generatedRoundNumber,
|
|
27117
27134
|
participantIdPairings,
|
|
27135
|
+
modifiedScaleValues,
|
|
27118
27136
|
candidatesCount,
|
|
27119
27137
|
...SUCCESS,
|
|
27120
27138
|
iterations,
|
|
@@ -32237,7 +32255,7 @@ function drawMatic(params) {
|
|
|
32237
32255
|
const structureResult = getAdHocStructure(params);
|
|
32238
32256
|
if (structureResult.error)
|
|
32239
32257
|
return structureResult;
|
|
32240
|
-
|
|
32258
|
+
let adHocRatings = getAdHocRatings(params);
|
|
32241
32259
|
const isMock = params.tournamentRecord?.isMock ?? params.isMock;
|
|
32242
32260
|
const eventType = params.eventType ?? params.event?.eventType;
|
|
32243
32261
|
const matchUps = [];
|
|
@@ -32258,6 +32276,8 @@ function drawMatic(params) {
|
|
|
32258
32276
|
if (result.error)
|
|
32259
32277
|
return result;
|
|
32260
32278
|
const { matchUps: roundMatchUps, ...roundResult } = result;
|
|
32279
|
+
if (roundResult.modifiedScaleValues)
|
|
32280
|
+
adHocRatings = roundResult.modifiedScaleValues;
|
|
32261
32281
|
roundResults.push({ ...roundResult, iteration, matchUpsCount: roundMatchUps?.length });
|
|
32262
32282
|
roundNumber = (roundResult?.roundNumber ?? 1) + 1;
|
|
32263
32283
|
if (roundMatchUps?.length) {
|
|
@@ -51375,6 +51395,7 @@ function addPersons({ participantRole = COMPETITOR, tournamentRecord, persons })
|
|
|
51375
51395
|
|
|
51376
51396
|
var mutate$5 = {
|
|
51377
51397
|
__proto__: null,
|
|
51398
|
+
addDynamicRatings: addDynamicRatings,
|
|
51378
51399
|
addIndividualParticipantIds: addIndividualParticipantIds,
|
|
51379
51400
|
addParticipant: addParticipant,
|
|
51380
51401
|
addParticipants: addParticipants,
|
|
@@ -51405,6 +51426,7 @@ var mutate$5 = {
|
|
|
51405
51426
|
|
|
51406
51427
|
var index$8 = {
|
|
51407
51428
|
__proto__: null,
|
|
51429
|
+
addDynamicRatings: addDynamicRatings,
|
|
51408
51430
|
addIndividualParticipantIds: addIndividualParticipantIds,
|
|
51409
51431
|
addParticipant: addParticipant,
|
|
51410
51432
|
addParticipants: addParticipants,
|