tods-competition-factory 1.8.39 → 1.8.41
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/query.mjs +4 -0
- package/dist/forge/query.mjs.map +1 -1
- package/dist/index.mjs +63 -29
- package/dist/index.mjs.map +1 -1
- package/dist/tods-competition-factory.development.cjs.js +92 -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 +4 -4
|
@@ -2929,7 +2929,7 @@ var matchUpFormatCode = {
|
|
|
2929
2929
|
};
|
|
2930
2930
|
|
|
2931
2931
|
function factoryVersion() {
|
|
2932
|
-
return '1.8.
|
|
2932
|
+
return '1.8.41';
|
|
2933
2933
|
}
|
|
2934
2934
|
|
|
2935
2935
|
function getObjectTieFormat(obj) {
|
|
@@ -16856,11 +16856,12 @@ var _a$9, _b$4, _c, _d, _e;
|
|
|
16856
16856
|
var ADULT = 'ADULT';
|
|
16857
16857
|
var JUNIOR = 'JUNIOR';
|
|
16858
16858
|
var WHEELCHAIR = 'WHEELCHAIR';
|
|
16859
|
-
/**
|
|
16860
|
-
*
|
|
16861
|
-
*/
|
|
16862
16859
|
var POLICY_SCHEDULING_DEFAULT = (_a$9 = {},
|
|
16863
16860
|
_a$9[POLICY_TYPE_SCHEDULING] = {
|
|
16861
|
+
allowModificationWhenMatchUpsScheduled: {
|
|
16862
|
+
courts: false,
|
|
16863
|
+
venues: false,
|
|
16864
|
+
},
|
|
16864
16865
|
defaultTimes: {
|
|
16865
16866
|
averageTimes: [{ categoryNames: [], minutes: { default: 90 } }],
|
|
16866
16867
|
recoveryTimes: [{ minutes: (_b$4 = {}, _b$4[DOUBLES$1] = 30, _b$4.default = 60, _b$4) }],
|
|
@@ -17137,6 +17138,10 @@ var _a$7, _b$2;
|
|
|
17137
17138
|
var POLICY_SCORING_DEFAULT = (_a$7 = {},
|
|
17138
17139
|
_a$7[POLICY_TYPE_SCORING] = {
|
|
17139
17140
|
defaultMatchUpFormat: FORMAT_STANDARD,
|
|
17141
|
+
allowDeletionWithScoresPresent: {
|
|
17142
|
+
drawDefinitions: false,
|
|
17143
|
+
structures: false,
|
|
17144
|
+
},
|
|
17140
17145
|
requireAllPositionsAssigned: false,
|
|
17141
17146
|
processCodes: {
|
|
17142
17147
|
incompleteAssignmentsOnDefault: ['RANKING.IGNORE'],
|
|
@@ -40551,7 +40556,7 @@ function deletionMessage(_a) {
|
|
|
40551
40556
|
|
|
40552
40557
|
function deleteVenue$1(_a) {
|
|
40553
40558
|
var e_1, _b;
|
|
40554
|
-
var _c, _d;
|
|
40559
|
+
var _c, _d, _e, _f, _g;
|
|
40555
40560
|
var tournamentRecord = _a.tournamentRecord, venueId = _a.venueId, force = _a.force;
|
|
40556
40561
|
if (!tournamentRecord)
|
|
40557
40562
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -40562,7 +40567,12 @@ function deleteVenue$1(_a) {
|
|
|
40562
40567
|
tournamentRecord: tournamentRecord,
|
|
40563
40568
|
contextFilters: contextFilters,
|
|
40564
40569
|
}).matchUps) !== null && _c !== void 0 ? _c : [];
|
|
40565
|
-
|
|
40570
|
+
var appliedPolicies = (_d = getAppliedPolicies({
|
|
40571
|
+
tournamentRecord: tournamentRecord,
|
|
40572
|
+
})) === null || _d === void 0 ? void 0 : _d.appliedPolicies;
|
|
40573
|
+
var allowModificationWhenMatchUpsScheduled = force ||
|
|
40574
|
+
((_f = (_e = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCHEDULING]) === null || _e === void 0 ? void 0 : _e.allowDeletionWithScoresPresent) === null || _f === void 0 ? void 0 : _f.venues);
|
|
40575
|
+
if (!matchUpsToUnschedule.length || allowModificationWhenMatchUpsScheduled) {
|
|
40566
40576
|
try {
|
|
40567
40577
|
// if no matchUpsToUnschedule this does nothing but avoid the deletionMessage
|
|
40568
40578
|
for (var matchUpsToUnschedule_1 = __values(matchUpsToUnschedule), matchUpsToUnschedule_1_1 = matchUpsToUnschedule_1.next(); !matchUpsToUnschedule_1_1.done; matchUpsToUnschedule_1_1 = matchUpsToUnschedule_1.next()) {
|
|
@@ -40588,7 +40598,7 @@ function deleteVenue$1(_a) {
|
|
|
40588
40598
|
return deletionMessage({ matchUpsCount: matchUpsToUnschedule.length });
|
|
40589
40599
|
}
|
|
40590
40600
|
var deleted;
|
|
40591
|
-
tournamentRecord.venues = ((
|
|
40601
|
+
tournamentRecord.venues = ((_g = tournamentRecord.venues) !== null && _g !== void 0 ? _g : []).filter(function (venue) {
|
|
40592
40602
|
if ((venue === null || venue === void 0 ? void 0 : venue.venueId) !== venueId)
|
|
40593
40603
|
return true;
|
|
40594
40604
|
deleted = true;
|
|
@@ -40808,8 +40818,8 @@ function getScheduledVenueMatchUps(_a) {
|
|
|
40808
40818
|
|
|
40809
40819
|
function deleteCourt$1(_a) {
|
|
40810
40820
|
var e_1, _b;
|
|
40811
|
-
var _c;
|
|
40812
|
-
var tournamentRecord = _a.tournamentRecord,
|
|
40821
|
+
var _c, _d, _e, _f;
|
|
40822
|
+
var tournamentRecord = _a.tournamentRecord, disableNotice = _a.disableNotice, courtId = _a.courtId, force = _a.force;
|
|
40813
40823
|
var result = findCourt({ tournamentRecord: tournamentRecord, courtId: courtId });
|
|
40814
40824
|
if (result.error)
|
|
40815
40825
|
return result;
|
|
@@ -40818,15 +40828,19 @@ function deleteCourt$1(_a) {
|
|
|
40818
40828
|
tournamentRecord: tournamentRecord,
|
|
40819
40829
|
courtId: courtId,
|
|
40820
40830
|
}).matchUps;
|
|
40821
|
-
|
|
40831
|
+
var appliedPolicies = (_c = getAppliedPolicies({
|
|
40832
|
+
tournamentRecord: tournamentRecord,
|
|
40833
|
+
})) === null || _c === void 0 ? void 0 : _c.appliedPolicies;
|
|
40834
|
+
var allowModificationWhenMatchUpsScheduled = force ||
|
|
40835
|
+
((_e = (_d = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCHEDULING]) === null || _d === void 0 ? void 0 : _d.allowDeletionWithScoresPresent) === null || _e === void 0 ? void 0 : _e.courts);
|
|
40836
|
+
if (!(matchUps === null || matchUps === void 0 ? void 0 : matchUps.length) || allowModificationWhenMatchUpsScheduled) {
|
|
40822
40837
|
try {
|
|
40823
|
-
for (var
|
|
40824
|
-
var matchUp =
|
|
40838
|
+
for (var _g = __values(matchUps !== null && matchUps !== void 0 ? matchUps : []), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
40839
|
+
var matchUp = _h.value;
|
|
40825
40840
|
var result_1 = removeCourtAssignment({
|
|
40826
40841
|
matchUpId: matchUp.matchUpId,
|
|
40827
40842
|
drawId: matchUp.drawId,
|
|
40828
40843
|
tournamentRecord: tournamentRecord,
|
|
40829
|
-
drawDefinition: drawDefinition,
|
|
40830
40844
|
});
|
|
40831
40845
|
if (result_1.error)
|
|
40832
40846
|
return result_1;
|
|
@@ -40835,12 +40849,12 @@ function deleteCourt$1(_a) {
|
|
|
40835
40849
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
40836
40850
|
finally {
|
|
40837
40851
|
try {
|
|
40838
|
-
if (
|
|
40852
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
40839
40853
|
}
|
|
40840
40854
|
finally { if (e_1) throw e_1.error; }
|
|
40841
40855
|
}
|
|
40842
40856
|
if (venue) {
|
|
40843
|
-
venue.courts = ((
|
|
40857
|
+
venue.courts = ((_f = venue.courts) !== null && _f !== void 0 ? _f : []).filter(function (courtRecord) {
|
|
40844
40858
|
return courtRecord.courtId !== courtId;
|
|
40845
40859
|
});
|
|
40846
40860
|
if (!disableNotice)
|
|
@@ -41032,7 +41046,8 @@ function validDateAvailability(_a) {
|
|
|
41032
41046
|
}
|
|
41033
41047
|
|
|
41034
41048
|
function modifyCourtAvailability(_a) {
|
|
41035
|
-
var
|
|
41049
|
+
var _b, _c, _d;
|
|
41050
|
+
var tournamentRecord = _a.tournamentRecord, dateAvailability = _a.dateAvailability, disableNotice = _a.disableNotice, venueMatchUps = _a.venueMatchUps, courtId = _a.courtId, force = _a.force;
|
|
41036
41051
|
if (!tournamentRecord)
|
|
41037
41052
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
41038
41053
|
if (!courtId)
|
|
@@ -41040,7 +41055,7 @@ function modifyCourtAvailability(_a) {
|
|
|
41040
41055
|
var dateResult = validDateAvailability({ dateAvailability: dateAvailability });
|
|
41041
41056
|
if (dateResult.error)
|
|
41042
41057
|
return dateResult;
|
|
41043
|
-
var
|
|
41058
|
+
var _e = sortAndMergeDateAvailability(dateAvailability), updatedDateAvailability = _e.updatedDateAvailability, totalMergeCount = _e.totalMergeCount;
|
|
41044
41059
|
dateAvailability = updatedDateAvailability;
|
|
41045
41060
|
var courtResult = findCourt({ tournamentRecord: tournamentRecord, courtId: courtId });
|
|
41046
41061
|
if (courtResult.error)
|
|
@@ -41054,6 +41069,11 @@ function modifyCourtAvailability(_a) {
|
|
|
41054
41069
|
// TODO: check whether there are matchUps which are no longer possible to play
|
|
41055
41070
|
// this will only apply to Pro Scheduling
|
|
41056
41071
|
if (courtMatchUps === null || courtMatchUps === void 0 ? void 0 : courtMatchUps.length) {
|
|
41072
|
+
var appliedPolicies = (_b = getAppliedPolicies({
|
|
41073
|
+
tournamentRecord: tournamentRecord,
|
|
41074
|
+
})) === null || _b === void 0 ? void 0 : _b.appliedPolicies;
|
|
41075
|
+
force ||
|
|
41076
|
+
((_d = (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCHEDULING]) === null || _c === void 0 ? void 0 : _c.allowDeletionWithScoresPresent) === null || _d === void 0 ? void 0 : _d.courts);
|
|
41057
41077
|
console.log('scheduled court matchUps', courtMatchUps.length);
|
|
41058
41078
|
}
|
|
41059
41079
|
if (court) {
|
|
@@ -41361,7 +41381,7 @@ function addCourts$1(_a) {
|
|
|
41361
41381
|
|
|
41362
41382
|
function modifyVenue$1(_a) {
|
|
41363
41383
|
var e_1, _b;
|
|
41364
|
-
var _c, _d, _e, _f, _g;
|
|
41384
|
+
var _c, _d, _e, _f, _g, _h, _j, _k;
|
|
41365
41385
|
var tournamentRecord = _a.tournamentRecord, modifications = _a.modifications, venueId = _a.venueId, force = _a.force;
|
|
41366
41386
|
if (!tournamentRecord)
|
|
41367
41387
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
@@ -41369,6 +41389,11 @@ function modifyVenue$1(_a) {
|
|
|
41369
41389
|
return { error: INVALID_OBJECT };
|
|
41370
41390
|
if (!venueId)
|
|
41371
41391
|
return { error: MISSING_VENUE_ID };
|
|
41392
|
+
var appliedPolicies = (_c = getAppliedPolicies({
|
|
41393
|
+
tournamentRecord: tournamentRecord,
|
|
41394
|
+
})) === null || _c === void 0 ? void 0 : _c.appliedPolicies;
|
|
41395
|
+
var allowModificationWhenMatchUpsScheduled = force ||
|
|
41396
|
+
((_e = (_d = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCHEDULING]) === null || _d === void 0 ? void 0 : _d.allowDeletionWithScoresPresent) === null || _e === void 0 ? void 0 : _e.venues);
|
|
41372
41397
|
var venueMatchUps = getScheduledVenueMatchUps({
|
|
41373
41398
|
tournamentRecord: tournamentRecord,
|
|
41374
41399
|
venueId: venueId,
|
|
@@ -41389,11 +41414,11 @@ function modifyVenue$1(_a) {
|
|
|
41389
41414
|
var _a;
|
|
41390
41415
|
return Object.assign(venue, (_a = {}, _a[attribute] = modifications[attribute], _a));
|
|
41391
41416
|
});
|
|
41392
|
-
var existingCourtIds = (
|
|
41393
|
-
var courtIdsToModify = ((
|
|
41417
|
+
var existingCourtIds = (_g = (_f = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _f === void 0 ? void 0 : _f.map(function (court) { return court.courtId; })) !== null && _g !== void 0 ? _g : [];
|
|
41418
|
+
var courtIdsToModify = ((_h = modifications.courts) === null || _h === void 0 ? void 0 : _h.map(function (court) { return court.courtId; })) || [];
|
|
41394
41419
|
var courtIdsToDelete = existingCourtIds.filter(function (courtId) { return !courtIdsToModify.includes(courtId); });
|
|
41395
41420
|
if (courtIdsToDelete.length) {
|
|
41396
|
-
var courtsToDelete = (
|
|
41421
|
+
var courtsToDelete = (_j = venue === null || venue === void 0 ? void 0 : venue.courts) === null || _j === void 0 ? void 0 : _j.filter(function (court) {
|
|
41397
41422
|
return courtIdsToDelete.includes(court.courtId);
|
|
41398
41423
|
});
|
|
41399
41424
|
var scheduleDeletionsCount = courtsToDelete === null || courtsToDelete === void 0 ? void 0 : courtsToDelete.map(function (court) {
|
|
@@ -41406,8 +41431,9 @@ function modifyVenue$1(_a) {
|
|
|
41406
41431
|
});
|
|
41407
41432
|
return (_b = (_a = result.matchUps) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0;
|
|
41408
41433
|
}).reduce(function (a, b) { return a + b; });
|
|
41409
|
-
if (venue &&
|
|
41410
|
-
|
|
41434
|
+
if (venue &&
|
|
41435
|
+
(!scheduleDeletionsCount || allowModificationWhenMatchUpsScheduled)) {
|
|
41436
|
+
venue.courts = (_k = venue.courts) === null || _k === void 0 ? void 0 : _k.filter(function (court) {
|
|
41411
41437
|
return courtIdsToModify.includes(court.courtId);
|
|
41412
41438
|
});
|
|
41413
41439
|
}
|
|
@@ -41419,8 +41445,8 @@ function modifyVenue$1(_a) {
|
|
|
41419
41445
|
}
|
|
41420
41446
|
if (modifications.courts) {
|
|
41421
41447
|
try {
|
|
41422
|
-
for (var
|
|
41423
|
-
var court =
|
|
41448
|
+
for (var _l = __values(modifications.courts), _m = _l.next(); !_m.done; _m = _l.next()) {
|
|
41449
|
+
var court = _m.value;
|
|
41424
41450
|
var courtId = (court || {}).courtId;
|
|
41425
41451
|
var result_1 = modifyCourt$1({
|
|
41426
41452
|
modifications: court,
|
|
@@ -41445,7 +41471,7 @@ function modifyVenue$1(_a) {
|
|
|
41445
41471
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
41446
41472
|
finally {
|
|
41447
41473
|
try {
|
|
41448
|
-
if (
|
|
41474
|
+
if (_m && !_m.done && (_b = _l.return)) _b.call(_l);
|
|
41449
41475
|
}
|
|
41450
41476
|
finally { if (e_1) throw e_1.error; }
|
|
41451
41477
|
}
|
|
@@ -48102,7 +48128,7 @@ function renameStructures$1(_a) {
|
|
|
48102
48128
|
}
|
|
48103
48129
|
|
|
48104
48130
|
function removeStructure(_a) {
|
|
48105
|
-
var _b, _c, _d;
|
|
48131
|
+
var _b, _c, _d, _e, _f, _g;
|
|
48106
48132
|
var tournamentRecord = _a.tournamentRecord, drawDefinition = _a.drawDefinition, structureId = _a.structureId, event = _a.event, force = _a.force;
|
|
48107
48133
|
if (typeof structureId !== 'string')
|
|
48108
48134
|
return { error: INVALID_VALUES };
|
|
@@ -48121,8 +48147,18 @@ function removeStructure(_a) {
|
|
|
48121
48147
|
var score = _a.score;
|
|
48122
48148
|
return scoreHasValue({ score: score });
|
|
48123
48149
|
});
|
|
48124
|
-
if (scoresPresent
|
|
48125
|
-
|
|
48150
|
+
if (scoresPresent) {
|
|
48151
|
+
var appliedPolicies = (_b = getAppliedPolicies({
|
|
48152
|
+
tournamentRecord: tournamentRecord,
|
|
48153
|
+
drawDefinition: drawDefinition,
|
|
48154
|
+
structure: structure,
|
|
48155
|
+
event: event,
|
|
48156
|
+
})) === null || _b === void 0 ? void 0 : _b.appliedPolicies;
|
|
48157
|
+
var allowDeletionWithScoresPresent = force ||
|
|
48158
|
+
((_d = (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCORING]) === null || _c === void 0 ? void 0 : _c.allowDeletionWithScoresPresent) === null || _d === void 0 ? void 0 : _d.structures);
|
|
48159
|
+
if (!allowDeletionWithScoresPresent)
|
|
48160
|
+
return { error: SCORES_PRESENT };
|
|
48161
|
+
}
|
|
48126
48162
|
var mainStageSequence1 = structures.find(function (_a) {
|
|
48127
48163
|
var stage = _a.stage, stageSequence = _a.stageSequence;
|
|
48128
48164
|
return stage === MAIN && stageSequence === 1;
|
|
@@ -48173,14 +48209,14 @@ function removeStructure(_a) {
|
|
|
48173
48209
|
var matchUpIds = getMatchUpIds(matchUps_1);
|
|
48174
48210
|
removedMatchUpIds.push.apply(removedMatchUpIds, __spreadArray([], __read(matchUpIds), false));
|
|
48175
48211
|
drawDefinition.links =
|
|
48176
|
-
((
|
|
48212
|
+
((_e = drawDefinition.links) === null || _e === void 0 ? void 0 : _e.filter(function (link) {
|
|
48177
48213
|
return link.source.structureId !== idBeingRemoved &&
|
|
48178
48214
|
link.target.structureId !== idBeingRemoved;
|
|
48179
48215
|
})) || [];
|
|
48180
48216
|
if (!isMainStageSequence1 ||
|
|
48181
48217
|
(isMainStageSequence1 && qualifyingStructureIds.length) ||
|
|
48182
48218
|
idBeingRemoved !== structureId) {
|
|
48183
|
-
drawDefinition.structures = ((
|
|
48219
|
+
drawDefinition.structures = ((_f = drawDefinition.structures) !== null && _f !== void 0 ? _f : []).filter(function (structure) {
|
|
48184
48220
|
if (idBeingRemoved && idBeingRemoved === structure.structureId)
|
|
48185
48221
|
removedStructureIds.push(idBeingRemoved);
|
|
48186
48222
|
return structure.structureId !== idBeingRemoved;
|
|
@@ -48189,7 +48225,7 @@ function removeStructure(_a) {
|
|
|
48189
48225
|
var targetedStructureIds = idBeingRemoved &&
|
|
48190
48226
|
(
|
|
48191
48227
|
// targetedStructureIdsMap[idBeingRemoved].filter(
|
|
48192
|
-
(
|
|
48228
|
+
(_g = relatedStructureIdsMap.get(idBeingRemoved)) === null || _g === void 0 ? void 0 : _g.filter(function (id) {
|
|
48193
48229
|
// IMPORTANT: only delete MAIN stageSequence: 1 if specified to protect against DOUBLE_ELIMINATION scenario
|
|
48194
48230
|
return id !== (mainStageSequence1 === null || mainStageSequence1 === void 0 ? void 0 : mainStageSequence1.structureId) ||
|
|
48195
48231
|
structureId === mainStageSequence1.structureId;
|
|
@@ -61127,17 +61163,17 @@ function getPositionAssignments(_a) {
|
|
|
61127
61163
|
};
|
|
61128
61164
|
}
|
|
61129
61165
|
|
|
61130
|
-
function deleteDrawDefinitions(
|
|
61131
|
-
var e_1,
|
|
61132
|
-
var _c, _d, _e;
|
|
61133
|
-
|
|
61134
|
-
if (!tournamentRecord)
|
|
61166
|
+
function deleteDrawDefinitions(params) {
|
|
61167
|
+
var e_1, _a;
|
|
61168
|
+
var _b, _c, _d, _e, _f, _g;
|
|
61169
|
+
if (!params.tournamentRecord)
|
|
61135
61170
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
61136
61171
|
var stack = 'deleteDrawDefinitions';
|
|
61137
|
-
|
|
61138
|
-
|
|
61139
|
-
|
|
61140
|
-
}
|
|
61172
|
+
var drawIds = (_b = params.drawIds) !== null && _b !== void 0 ? _b : [];
|
|
61173
|
+
var event = params.event;
|
|
61174
|
+
var _h = params.autoPublish, autoPublish = _h === void 0 ? true : _h, tournamentRecord = params.tournamentRecord, auditData = params.auditData, eventId = params.eventId, force = params.force;
|
|
61175
|
+
var appliedPolicies = getAppliedPolicies({ tournamentRecord: tournamentRecord, event: event }).appliedPolicies;
|
|
61176
|
+
var policyDefinitions = __assign(__assign({}, appliedPolicies), params.policyDefinitions);
|
|
61141
61177
|
var drawId = Array.isArray(drawIds) ? drawIds[0] : undefined;
|
|
61142
61178
|
if (!event) {
|
|
61143
61179
|
var result = findEvent({ tournamentRecord: tournamentRecord, eventId: eventId, drawId: drawId });
|
|
@@ -61173,6 +61209,8 @@ function deleteDrawDefinitions(_a) {
|
|
|
61173
61209
|
var participantId = _a.participantId, drawPosition = _a.drawPosition, qualifier = _a.qualifier, bye = _a.bye;
|
|
61174
61210
|
return ({ bye: bye, qualifier: qualifier, drawPosition: drawPosition, participantId: participantId });
|
|
61175
61211
|
};
|
|
61212
|
+
var allowDeletionWithScoresPresent = force ||
|
|
61213
|
+
((_d = (_c = appliedPolicies === null || appliedPolicies === void 0 ? void 0 : appliedPolicies[POLICY_TYPE_SCORING]) === null || _c === void 0 ? void 0 : _c.allowDeletionWithScoresPresent) === null || _d === void 0 ? void 0 : _d.drawDefinitions);
|
|
61176
61214
|
var drawIdsWithScoresPresent = [];
|
|
61177
61215
|
var filteredDrawDefinitions = event.drawDefinitions.filter(function (drawDefinition) {
|
|
61178
61216
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -61182,7 +61220,7 @@ function deleteDrawDefinitions(_a) {
|
|
|
61182
61220
|
var score = _a.score;
|
|
61183
61221
|
return scoreHasValue({ score: score });
|
|
61184
61222
|
});
|
|
61185
|
-
if (scoresPresent && !
|
|
61223
|
+
if (scoresPresent && !allowDeletionWithScoresPresent) {
|
|
61186
61224
|
drawIdsWithScoresPresent.push(drawDefinition.drawId);
|
|
61187
61225
|
return true;
|
|
61188
61226
|
}
|
|
@@ -61267,21 +61305,21 @@ function deleteDrawDefinitions(_a) {
|
|
|
61267
61305
|
checkSchedulingProfile({ tournamentRecord: tournamentRecord });
|
|
61268
61306
|
var itemType = "".concat(PUBLISH, ".").concat(STATUS$1);
|
|
61269
61307
|
var timeItem = getTimeItem({ element: event, itemType: itemType }).timeItem;
|
|
61270
|
-
var publishStatus = (
|
|
61308
|
+
var publishStatus = (_e = timeItem === null || timeItem === void 0 ? void 0 : timeItem.itemValue) === null || _e === void 0 ? void 0 : _e[PUBLIC];
|
|
61271
61309
|
var publishedDrawsDeleted;
|
|
61272
61310
|
var _loop_1 = function (drawId_2) {
|
|
61273
|
-
var
|
|
61274
|
-
var drawPublished = (
|
|
61311
|
+
var _j;
|
|
61312
|
+
var drawPublished = (_f = publishStatus === null || publishStatus === void 0 ? void 0 : publishStatus.drawIds) === null || _f === void 0 ? void 0 : _f.includes(drawId_2);
|
|
61275
61313
|
if (drawPublished) {
|
|
61276
61314
|
publishedDrawsDeleted = true;
|
|
61277
|
-
var updatedDrawIds = ((
|
|
61315
|
+
var updatedDrawIds = ((_g = publishStatus.drawIds) === null || _g === void 0 ? void 0 : _g.filter(function (publishedDrawId) { return publishedDrawId !== drawId_2; })) || [];
|
|
61278
61316
|
var timeItem_1 = {
|
|
61279
61317
|
itemType: "".concat(PUBLISH, ".").concat(STATUS$1),
|
|
61280
|
-
itemValue: (
|
|
61281
|
-
|
|
61318
|
+
itemValue: (_j = {},
|
|
61319
|
+
_j[PUBLIC] = {
|
|
61282
61320
|
drawIds: updatedDrawIds,
|
|
61283
61321
|
},
|
|
61284
|
-
|
|
61322
|
+
_j),
|
|
61285
61323
|
};
|
|
61286
61324
|
var result = addEventTimeItem({ event: event, timeItem: timeItem_1 });
|
|
61287
61325
|
if (result.error)
|
|
@@ -61299,7 +61337,7 @@ function deleteDrawDefinitions(_a) {
|
|
|
61299
61337
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
61300
61338
|
finally {
|
|
61301
61339
|
try {
|
|
61302
|
-
if (drawIds_1_1 && !drawIds_1_1.done && (
|
|
61340
|
+
if (drawIds_1_1 && !drawIds_1_1.done && (_a = drawIds_1.return)) _a.call(drawIds_1);
|
|
61303
61341
|
}
|
|
61304
61342
|
finally { if (e_1) throw e_1.error; }
|
|
61305
61343
|
}
|
|
@@ -63087,7 +63125,7 @@ function resetVoluntaryConsolationStructure(_a) {
|
|
|
63087
63125
|
|
|
63088
63126
|
function deleteFlightProfileAndFlightDraws(_a) {
|
|
63089
63127
|
var _b;
|
|
63090
|
-
var _c = _a.autoPublish, autoPublish = _c === void 0 ? true : _c, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, event = _a.event;
|
|
63128
|
+
var _c = _a.autoPublish, autoPublish = _c === void 0 ? true : _c, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, event = _a.event, force = _a.force;
|
|
63091
63129
|
if (!tournamentRecord)
|
|
63092
63130
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63093
63131
|
if (!event)
|
|
@@ -63105,6 +63143,7 @@ function deleteFlightProfileAndFlightDraws(_a) {
|
|
|
63105
63143
|
auditData: auditData,
|
|
63106
63144
|
drawIds: drawIds,
|
|
63107
63145
|
event: event,
|
|
63146
|
+
force: force,
|
|
63108
63147
|
});
|
|
63109
63148
|
if (result.error)
|
|
63110
63149
|
return result;
|
|
@@ -63187,7 +63226,7 @@ function refreshEventDrawOrder(_a) {
|
|
|
63187
63226
|
|
|
63188
63227
|
function deleteFlightAndFlightDraw(_a) {
|
|
63189
63228
|
var _b, _c;
|
|
63190
|
-
var _d = _a.autoPublish, autoPublish = _d === void 0 ? true : _d, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, drawId = _a.drawId, event = _a.event;
|
|
63229
|
+
var _d = _a.autoPublish, autoPublish = _d === void 0 ? true : _d, tournamentRecord = _a.tournamentRecord, auditData = _a.auditData, drawId = _a.drawId, event = _a.event, force = _a.force;
|
|
63191
63230
|
if (!tournamentRecord)
|
|
63192
63231
|
return { error: MISSING_TOURNAMENT_RECORD };
|
|
63193
63232
|
if (!drawId)
|
|
@@ -63217,6 +63256,7 @@ function deleteFlightAndFlightDraw(_a) {
|
|
|
63217
63256
|
autoPublish: autoPublish,
|
|
63218
63257
|
auditData: auditData,
|
|
63219
63258
|
event: event,
|
|
63259
|
+
force: force,
|
|
63220
63260
|
});
|
|
63221
63261
|
if (result.error)
|
|
63222
63262
|
return result;
|