tods-competition-factory 0.83.2 → 0.85.0
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/tods-competition-factory.development.cjs.js +344 -126
- 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/dist/tods-competition-factory.production.esm.min.js +1 -1
- package/dist/tods-competition-factory.production.esm.min.js.map +1 -1
- package/package.json +3 -2
|
@@ -249,7 +249,7 @@ const matchUpFormatCode = {
|
|
|
249
249
|
};
|
|
250
250
|
|
|
251
251
|
function factoryVersion() {
|
|
252
|
-
return '0.
|
|
252
|
+
return '0.85.0';
|
|
253
253
|
}
|
|
254
254
|
|
|
255
255
|
const FORMAT_STANDARD = 'SET3-S:6/TB7'; // Best of 3 Tiebreak Sets to 6
|
|
@@ -7381,7 +7381,7 @@ const countries = [{
|
|
|
7381
7381
|
phone: '263'
|
|
7382
7382
|
}];
|
|
7383
7383
|
|
|
7384
|
-
var collectionDefinitions$
|
|
7384
|
+
var collectionDefinitions$9 = [
|
|
7385
7385
|
{
|
|
7386
7386
|
collectionName: "Doubles",
|
|
7387
7387
|
matchUpCount: 3,
|
|
@@ -7397,17 +7397,17 @@ var collectionDefinitions$5 = [
|
|
|
7397
7397
|
matchUpValue: 1
|
|
7398
7398
|
}
|
|
7399
7399
|
];
|
|
7400
|
-
var tieFormatName$
|
|
7401
|
-
var winCriteria$
|
|
7400
|
+
var tieFormatName$8 = "COLLEGE_D3";
|
|
7401
|
+
var winCriteria$9 = {
|
|
7402
7402
|
valueGoal: 5
|
|
7403
7403
|
};
|
|
7404
7404
|
var COLLEGE_D3$1 = {
|
|
7405
|
-
collectionDefinitions: collectionDefinitions$
|
|
7406
|
-
tieFormatName: tieFormatName$
|
|
7407
|
-
winCriteria: winCriteria$
|
|
7405
|
+
collectionDefinitions: collectionDefinitions$9,
|
|
7406
|
+
tieFormatName: tieFormatName$8,
|
|
7407
|
+
winCriteria: winCriteria$9
|
|
7408
7408
|
};
|
|
7409
7409
|
|
|
7410
|
-
var collectionDefinitions$
|
|
7410
|
+
var collectionDefinitions$8 = [
|
|
7411
7411
|
{
|
|
7412
7412
|
collectionName: "Doubles",
|
|
7413
7413
|
collectionValue: 1,
|
|
@@ -7423,17 +7423,17 @@ var collectionDefinitions$4 = [
|
|
|
7423
7423
|
matchUpValue: 1
|
|
7424
7424
|
}
|
|
7425
7425
|
];
|
|
7426
|
-
var tieFormatName$
|
|
7427
|
-
var winCriteria$
|
|
7426
|
+
var tieFormatName$7 = "COLLEGE_DEFAULT";
|
|
7427
|
+
var winCriteria$8 = {
|
|
7428
7428
|
valueGoal: 5
|
|
7429
7429
|
};
|
|
7430
7430
|
var COLLEGE_DEFAULT$1 = {
|
|
7431
|
-
collectionDefinitions: collectionDefinitions$
|
|
7432
|
-
tieFormatName: tieFormatName$
|
|
7433
|
-
winCriteria: winCriteria$
|
|
7431
|
+
collectionDefinitions: collectionDefinitions$8,
|
|
7432
|
+
tieFormatName: tieFormatName$7,
|
|
7433
|
+
winCriteria: winCriteria$8
|
|
7434
7434
|
};
|
|
7435
7435
|
|
|
7436
|
-
var collectionDefinitions$
|
|
7436
|
+
var collectionDefinitions$7 = [
|
|
7437
7437
|
{
|
|
7438
7438
|
collectionName: "Doubles",
|
|
7439
7439
|
matchUpCount: 3,
|
|
@@ -7449,17 +7449,17 @@ var collectionDefinitions$3 = [
|
|
|
7449
7449
|
matchUpValue: 1
|
|
7450
7450
|
}
|
|
7451
7451
|
];
|
|
7452
|
-
var tieFormatName$
|
|
7453
|
-
var winCriteria$
|
|
7452
|
+
var tieFormatName$6 = "COLLEGE_JUCO";
|
|
7453
|
+
var winCriteria$7 = {
|
|
7454
7454
|
valueGoal: 5
|
|
7455
7455
|
};
|
|
7456
7456
|
var COLLEGE_JUCO$1 = {
|
|
7457
|
-
collectionDefinitions: collectionDefinitions$
|
|
7458
|
-
tieFormatName: tieFormatName$
|
|
7459
|
-
winCriteria: winCriteria$
|
|
7457
|
+
collectionDefinitions: collectionDefinitions$7,
|
|
7458
|
+
tieFormatName: tieFormatName$6,
|
|
7459
|
+
winCriteria: winCriteria$7
|
|
7460
7460
|
};
|
|
7461
7461
|
|
|
7462
|
-
var collectionDefinitions$
|
|
7462
|
+
var collectionDefinitions$6 = [
|
|
7463
7463
|
{
|
|
7464
7464
|
collectionName: "Doubles",
|
|
7465
7465
|
matchUpCount: 1,
|
|
@@ -7475,20 +7475,20 @@ var collectionDefinitions$2 = [
|
|
|
7475
7475
|
matchUpValue: 1
|
|
7476
7476
|
}
|
|
7477
7477
|
];
|
|
7478
|
-
var tieFormatName$
|
|
7479
|
-
var winCriteria$
|
|
7478
|
+
var tieFormatName$5 = "DOMINANT_DUO";
|
|
7479
|
+
var winCriteria$6 = {
|
|
7480
7480
|
valueGoal: 2
|
|
7481
7481
|
};
|
|
7482
7482
|
var DOMINANT_DUO_TIE_FORMAT = {
|
|
7483
|
-
collectionDefinitions: collectionDefinitions$
|
|
7484
|
-
tieFormatName: tieFormatName$
|
|
7485
|
-
winCriteria: winCriteria$
|
|
7483
|
+
collectionDefinitions: collectionDefinitions$6,
|
|
7484
|
+
tieFormatName: tieFormatName$5,
|
|
7485
|
+
winCriteria: winCriteria$6
|
|
7486
7486
|
};
|
|
7487
7487
|
|
|
7488
|
-
var winCriteria$
|
|
7488
|
+
var winCriteria$5 = {
|
|
7489
7489
|
valueGoal: 13
|
|
7490
7490
|
};
|
|
7491
|
-
var collectionDefinitions$
|
|
7491
|
+
var collectionDefinitions$5 = [
|
|
7492
7492
|
{
|
|
7493
7493
|
collectionGroupNumber: 1,
|
|
7494
7494
|
matchUpType: "DOUBLES",
|
|
@@ -7547,12 +7547,12 @@ var collectionGroups = [
|
|
|
7547
7547
|
}
|
|
7548
7548
|
];
|
|
7549
7549
|
var LAVER_CUP_TIE_FORMAT = {
|
|
7550
|
-
winCriteria: winCriteria$
|
|
7551
|
-
collectionDefinitions: collectionDefinitions$
|
|
7550
|
+
winCriteria: winCriteria$5,
|
|
7551
|
+
collectionDefinitions: collectionDefinitions$5,
|
|
7552
7552
|
collectionGroups: collectionGroups
|
|
7553
7553
|
};
|
|
7554
7554
|
|
|
7555
|
-
var collectionDefinitions = [
|
|
7555
|
+
var collectionDefinitions$4 = [
|
|
7556
7556
|
{
|
|
7557
7557
|
collectionName: "Round 1",
|
|
7558
7558
|
matchUpCount: 3,
|
|
@@ -7575,15 +7575,182 @@ var collectionDefinitions = [
|
|
|
7575
7575
|
scoreValue: 1
|
|
7576
7576
|
}
|
|
7577
7577
|
];
|
|
7578
|
-
var tieFormatName = "Doubles Shuffle";
|
|
7578
|
+
var tieFormatName$4 = "Doubles Shuffle";
|
|
7579
7579
|
var unrestrictedSelections = true;
|
|
7580
|
-
var winCriteria = {
|
|
7580
|
+
var winCriteria$4 = {
|
|
7581
7581
|
aggregateValue: true
|
|
7582
7582
|
};
|
|
7583
7583
|
var TEAM_AGGREGATION_TIE_FORMAT = {
|
|
7584
|
+
collectionDefinitions: collectionDefinitions$4,
|
|
7585
|
+
tieFormatName: tieFormatName$4,
|
|
7586
|
+
unrestrictedSelections: unrestrictedSelections,
|
|
7587
|
+
winCriteria: winCriteria$4
|
|
7588
|
+
};
|
|
7589
|
+
|
|
7590
|
+
var collectionDefinitions$3 = [
|
|
7591
|
+
{
|
|
7592
|
+
collectionName: "Boys Singles",
|
|
7593
|
+
matchUpCount: 6,
|
|
7594
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7595
|
+
matchUpType: "SINGLES",
|
|
7596
|
+
matchUpValue: 1
|
|
7597
|
+
},
|
|
7598
|
+
{
|
|
7599
|
+
collectionName: "Girls Singles",
|
|
7600
|
+
matchUpCount: 6,
|
|
7601
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7602
|
+
matchUpType: "SINGLES",
|
|
7603
|
+
matchUpValue: 1
|
|
7604
|
+
},
|
|
7605
|
+
{
|
|
7606
|
+
collectionName: "Boys Doubles",
|
|
7607
|
+
matchUpCount: 1,
|
|
7608
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7609
|
+
matchUpType: "DOUBLES",
|
|
7610
|
+
matchUpValue: 1
|
|
7611
|
+
},
|
|
7612
|
+
{
|
|
7613
|
+
collectionName: "Girls Doubles",
|
|
7614
|
+
matchUpCount: 1,
|
|
7615
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7616
|
+
matchUpType: "DOUBLES",
|
|
7617
|
+
matchUpValue: 1
|
|
7618
|
+
},
|
|
7619
|
+
{
|
|
7620
|
+
collectionName: "Mixed Doubles",
|
|
7621
|
+
matchUpCount: 1,
|
|
7622
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7623
|
+
matchUpType: "DOUBLES",
|
|
7624
|
+
matchUpValue: 1
|
|
7625
|
+
}
|
|
7626
|
+
];
|
|
7627
|
+
var tieFormatName$3 = "USTA_INTERSECTIONAL";
|
|
7628
|
+
var winCriteria$3 = {
|
|
7629
|
+
valueGoal: 8
|
|
7630
|
+
};
|
|
7631
|
+
var USTA_INTERSECTIONAL$1 = {
|
|
7632
|
+
collectionDefinitions: collectionDefinitions$3,
|
|
7633
|
+
tieFormatName: tieFormatName$3,
|
|
7634
|
+
winCriteria: winCriteria$3
|
|
7635
|
+
};
|
|
7636
|
+
|
|
7637
|
+
var collectionDefinitions$2 = [
|
|
7638
|
+
{
|
|
7639
|
+
collectionName: "Boys Singles",
|
|
7640
|
+
matchUpCount: 6,
|
|
7641
|
+
matchUpFormat: "SET3-S:6/TB7",
|
|
7642
|
+
matchUpType: "SINGLES",
|
|
7643
|
+
matchUpValue: 1
|
|
7644
|
+
},
|
|
7645
|
+
{
|
|
7646
|
+
collectionName: "Girls Singles",
|
|
7647
|
+
matchUpCount: 6,
|
|
7648
|
+
matchUpFormat: "SET3-S:6/TB7",
|
|
7649
|
+
matchUpType: "SINGLES",
|
|
7650
|
+
matchUpValue: 1
|
|
7651
|
+
},
|
|
7652
|
+
{
|
|
7653
|
+
collectionName: "Boys Doubles",
|
|
7654
|
+
matchUpCount: 3,
|
|
7655
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7656
|
+
matchUpType: "DOUBLES",
|
|
7657
|
+
matchUpValue: 1
|
|
7658
|
+
},
|
|
7659
|
+
{
|
|
7660
|
+
collectionName: "Girls Doubles",
|
|
7661
|
+
matchUpCount: 3,
|
|
7662
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7663
|
+
matchUpType: "DOUBLES",
|
|
7664
|
+
matchUpValue: 1
|
|
7665
|
+
}
|
|
7666
|
+
];
|
|
7667
|
+
var tieFormatName$2 = "USTA_LEVEL_1";
|
|
7668
|
+
var winCriteria$2 = {
|
|
7669
|
+
valueGoal: 10
|
|
7670
|
+
};
|
|
7671
|
+
var USTA_LEVEL_1$1 = {
|
|
7672
|
+
collectionDefinitions: collectionDefinitions$2,
|
|
7673
|
+
tieFormatName: tieFormatName$2,
|
|
7674
|
+
winCriteria: winCriteria$2
|
|
7675
|
+
};
|
|
7676
|
+
|
|
7677
|
+
var collectionDefinitions$1 = [
|
|
7678
|
+
{
|
|
7679
|
+
collectionName: "Boys Singles",
|
|
7680
|
+
matchUpCount: 6,
|
|
7681
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7682
|
+
matchUpType: "SINGLES",
|
|
7683
|
+
matchUpValue: 1
|
|
7684
|
+
},
|
|
7685
|
+
{
|
|
7686
|
+
collectionName: "Girls Singles",
|
|
7687
|
+
matchUpCount: 6,
|
|
7688
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7689
|
+
matchUpType: "SINGLES",
|
|
7690
|
+
matchUpValue: 1
|
|
7691
|
+
},
|
|
7692
|
+
{
|
|
7693
|
+
collectionName: "Mixed Doubles",
|
|
7694
|
+
matchUpCount: 3,
|
|
7695
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7696
|
+
matchUpType: "DOUBLES",
|
|
7697
|
+
matchUpValue: 1
|
|
7698
|
+
}
|
|
7699
|
+
];
|
|
7700
|
+
var tieFormatName$1 = "USTA_SOUTHERN_LEVEL_5";
|
|
7701
|
+
var winCriteria$1 = {
|
|
7702
|
+
valueGoal: 8
|
|
7703
|
+
};
|
|
7704
|
+
var USTA_SOUTHERN_LEVEL_5$1 = {
|
|
7705
|
+
collectionDefinitions: collectionDefinitions$1,
|
|
7706
|
+
tieFormatName: tieFormatName$1,
|
|
7707
|
+
winCriteria: winCriteria$1
|
|
7708
|
+
};
|
|
7709
|
+
|
|
7710
|
+
var collectionDefinitions = [
|
|
7711
|
+
{
|
|
7712
|
+
collectionName: "Boys Singles",
|
|
7713
|
+
matchUpCount: 6,
|
|
7714
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7715
|
+
matchUpType: "SINGLES",
|
|
7716
|
+
matchUpValue: 1
|
|
7717
|
+
},
|
|
7718
|
+
{
|
|
7719
|
+
collectionName: "Girls Singles",
|
|
7720
|
+
matchUpCount: 6,
|
|
7721
|
+
matchUpFormat: "SET3-S:6/TB7-F:TB10",
|
|
7722
|
+
matchUpType: "SINGLES",
|
|
7723
|
+
matchUpValue: 1
|
|
7724
|
+
},
|
|
7725
|
+
{
|
|
7726
|
+
collectionName: "Boys Doubles",
|
|
7727
|
+
matchUpCount: 3,
|
|
7728
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7729
|
+
matchUpType: "DOUBLES",
|
|
7730
|
+
matchUpValue: 1
|
|
7731
|
+
},
|
|
7732
|
+
{
|
|
7733
|
+
collectionName: "Girls Doubles",
|
|
7734
|
+
matchUpCount: 3,
|
|
7735
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7736
|
+
matchUpType: "DOUBLES",
|
|
7737
|
+
matchUpValue: 1
|
|
7738
|
+
},
|
|
7739
|
+
{
|
|
7740
|
+
collectionName: "Mixed Doubles",
|
|
7741
|
+
matchUpCount: 1,
|
|
7742
|
+
matchUpFormat: "SET1-S:8/TB7",
|
|
7743
|
+
matchUpType: "DOUBLES",
|
|
7744
|
+
matchUpValue: 1
|
|
7745
|
+
}
|
|
7746
|
+
];
|
|
7747
|
+
var tieFormatName = "USTA_ZONAL";
|
|
7748
|
+
var winCriteria = {
|
|
7749
|
+
valueGoal: 10
|
|
7750
|
+
};
|
|
7751
|
+
var USTA_ZONAL$1 = {
|
|
7584
7752
|
collectionDefinitions: collectionDefinitions,
|
|
7585
7753
|
tieFormatName: tieFormatName,
|
|
7586
|
-
unrestrictedSelections: unrestrictedSelections,
|
|
7587
7754
|
winCriteria: winCriteria
|
|
7588
7755
|
};
|
|
7589
7756
|
|
|
@@ -7593,7 +7760,11 @@ const tieFormats = {
|
|
|
7593
7760
|
COLLEGE_JUCO: COLLEGE_JUCO$1,
|
|
7594
7761
|
DOMINANT_DUO: DOMINANT_DUO_TIE_FORMAT,
|
|
7595
7762
|
LAVER_CUP: LAVER_CUP_TIE_FORMAT,
|
|
7596
|
-
TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT
|
|
7763
|
+
TEAM_DOUBLES_3_AGGREGATION: TEAM_AGGREGATION_TIE_FORMAT,
|
|
7764
|
+
USTA_INTERSECTIONAL: USTA_INTERSECTIONAL$1,
|
|
7765
|
+
USTA_LEVEL_1: USTA_LEVEL_1$1,
|
|
7766
|
+
USTA_SOUTHERN_LEVEL_5: USTA_SOUTHERN_LEVEL_5$1,
|
|
7767
|
+
USTA_ZONAL: USTA_ZONAL$1
|
|
7597
7768
|
};
|
|
7598
7769
|
|
|
7599
7770
|
const POLICY_AVOIDANCE_COUNTRY = {
|
|
@@ -8424,6 +8595,15 @@ const fixtures = {
|
|
|
8424
8595
|
flagIOC
|
|
8425
8596
|
};
|
|
8426
8597
|
|
|
8598
|
+
function getCourtDateAvailability({
|
|
8599
|
+
court,
|
|
8600
|
+
date
|
|
8601
|
+
}) {
|
|
8602
|
+
const targetDateAvailability = date && court.dateAvailability.find(availability => sameDay(availability.date, date));
|
|
8603
|
+
const defaultAvailability = court.dateAvailability.find(availability => !availability.date);
|
|
8604
|
+
return targetDateAvailability || defaultAvailability;
|
|
8605
|
+
}
|
|
8606
|
+
|
|
8427
8607
|
/**
|
|
8428
8608
|
*
|
|
8429
8609
|
* @param {object} courtDate - object containing court details for a specific date { date, startTime, endTime, bookings }
|
|
@@ -8463,16 +8643,13 @@ function generateTimeSlots({
|
|
|
8463
8643
|
return timeSlots;
|
|
8464
8644
|
}
|
|
8465
8645
|
|
|
8466
|
-
function
|
|
8646
|
+
function getEnoughTime({
|
|
8467
8647
|
includeBookingTypes,
|
|
8468
8648
|
averageMatchUpMinutes,
|
|
8469
8649
|
periodStartTime,
|
|
8470
8650
|
periodEndTime,
|
|
8471
|
-
periodLength
|
|
8472
|
-
date
|
|
8651
|
+
periodLength
|
|
8473
8652
|
}) {
|
|
8474
|
-
const sameDate = courtDate => !courtDate.date || sameDay(courtDate.date, date);
|
|
8475
|
-
|
|
8476
8653
|
const enoughTime = courtDate => {
|
|
8477
8654
|
const timeSlots = generateTimeSlots({
|
|
8478
8655
|
courtDate,
|
|
@@ -8494,7 +8671,6 @@ function getCourtDateFilters({
|
|
|
8494
8671
|
}
|
|
8495
8672
|
|
|
8496
8673
|
return {
|
|
8497
|
-
sameDate,
|
|
8498
8674
|
enoughTime
|
|
8499
8675
|
};
|
|
8500
8676
|
}
|
|
@@ -8510,19 +8686,21 @@ function getCourtsAvailableAtPeriodStart({
|
|
|
8510
8686
|
const periodStartTime = timeToDate(periodStart);
|
|
8511
8687
|
const periodEndTime = addMinutes(periodStartTime, averageMatchUpMinutes);
|
|
8512
8688
|
const {
|
|
8513
|
-
sameDate,
|
|
8514
8689
|
enoughTime
|
|
8515
|
-
} =
|
|
8690
|
+
} = getEnoughTime({
|
|
8516
8691
|
includeBookingTypes,
|
|
8517
8692
|
averageMatchUpMinutes,
|
|
8518
8693
|
periodStartTime,
|
|
8519
8694
|
periodEndTime,
|
|
8520
|
-
periodLength
|
|
8521
|
-
date
|
|
8695
|
+
periodLength
|
|
8522
8696
|
});
|
|
8523
8697
|
const availableCourts = courts.filter(court => {
|
|
8524
|
-
|
|
8525
|
-
|
|
8698
|
+
if (!Array.isArray(court.dateAvailability)) return false;
|
|
8699
|
+
const courtDate = getCourtDateAvailability({
|
|
8700
|
+
date,
|
|
8701
|
+
court
|
|
8702
|
+
});
|
|
8703
|
+
return !!(courtDate && enoughTime(courtDate));
|
|
8526
8704
|
});
|
|
8527
8705
|
return {
|
|
8528
8706
|
availableToScheduleCount: availableCourts.length
|
|
@@ -8579,23 +8757,21 @@ function generateVirtualCourts({
|
|
|
8579
8757
|
courtBookings: {},
|
|
8580
8758
|
unassignedBookings: []
|
|
8581
8759
|
});
|
|
8582
|
-
const {
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
});
|
|
8587
|
-
const inProcessCourts = courts.map(({
|
|
8588
|
-
courtId,
|
|
8589
|
-
dateAvailability
|
|
8590
|
-
}, index) => {
|
|
8760
|
+
const inProcessCourts = courts.map((court, index) => {
|
|
8761
|
+
const {
|
|
8762
|
+
courtId
|
|
8763
|
+
} = court;
|
|
8591
8764
|
const bookingsThisCourt = courtBookings[courtId] || [];
|
|
8592
|
-
const
|
|
8765
|
+
const availability = getCourtDateAvailability({
|
|
8766
|
+
date: scheduleDate,
|
|
8767
|
+
court
|
|
8768
|
+
}) || {};
|
|
8593
8769
|
const {
|
|
8594
8770
|
date,
|
|
8595
8771
|
startTime,
|
|
8596
8772
|
endTime,
|
|
8597
8773
|
bookings: existingBookings = []
|
|
8598
|
-
} =
|
|
8774
|
+
} = availability;
|
|
8599
8775
|
const allocatedTimeBooking = remainingScheduleTimes[index] && {
|
|
8600
8776
|
startTime,
|
|
8601
8777
|
endTime: remainingScheduleTimes[index]
|
|
@@ -8696,44 +8872,41 @@ function getFirstTimeSlotStartTime({
|
|
|
8696
8872
|
courts,
|
|
8697
8873
|
date
|
|
8698
8874
|
}) {
|
|
8699
|
-
|
|
8700
|
-
sameDate
|
|
8701
|
-
} = getCourtDateFilters({
|
|
8702
|
-
date
|
|
8703
|
-
}); // find the first timeSlot across all courts between startTime and endTime that can accommodate averageMatchUpMinutes
|
|
8704
|
-
|
|
8875
|
+
// find the first timeSlot across all courts between startTime and endTime that can accommodate averageMatchUpMinutes
|
|
8705
8876
|
let firstTimeSlotStartTime;
|
|
8706
8877
|
|
|
8707
8878
|
if (startTime && endTime) {
|
|
8708
8879
|
const dateStartTime = timeToDate(startTime);
|
|
8709
8880
|
const dateEndTime = timeToDate(endTime);
|
|
8710
|
-
|
|
8881
|
+
|
|
8882
|
+
for (const court of courts) {
|
|
8711
8883
|
if (!Array.isArray(court.dateAvailability)) return false;
|
|
8712
|
-
const
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
8722
|
-
|
|
8723
|
-
|
|
8724
|
-
|
|
8725
|
-
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
8730
|
-
|
|
8884
|
+
const courtDate = getCourtDateAvailability({
|
|
8885
|
+
court,
|
|
8886
|
+
date
|
|
8887
|
+
});
|
|
8888
|
+
const timeSlots = generateTimeSlots({
|
|
8889
|
+
courtDate
|
|
8890
|
+
});
|
|
8891
|
+
timeSlots.find(timeSlot => {
|
|
8892
|
+
const timeSlotStartTime = timeToDate(timeSlot.startTime);
|
|
8893
|
+
const timeSlotEndTime = timeToDate(timeSlot.endTime);
|
|
8894
|
+
if (timeSlotStartTime > dateEndTime || timeSlotStartTime < dateStartTime) return false;
|
|
8895
|
+
if (timeSlotEndTime < dateStartTime) return false;
|
|
8896
|
+
const timeSlotMinutes = minutesDifference(timeSlotStartTime, timeSlotEndTime);
|
|
8897
|
+
const available = timeSlotMinutes >= averageMinutes;
|
|
8898
|
+
|
|
8899
|
+
if (available) {
|
|
8900
|
+
const timeString = extractTime(timeSlotStartTime.toISOString());
|
|
8901
|
+
|
|
8902
|
+
if (!firstTimeSlotStartTime || timeString < firstTimeSlotStartTime) {
|
|
8903
|
+
firstTimeSlotStartTime = timeString;
|
|
8731
8904
|
}
|
|
8905
|
+
}
|
|
8732
8906
|
|
|
8733
|
-
|
|
8734
|
-
});
|
|
8907
|
+
return available;
|
|
8735
8908
|
});
|
|
8736
|
-
}
|
|
8909
|
+
}
|
|
8737
8910
|
}
|
|
8738
8911
|
|
|
8739
8912
|
return {
|
|
@@ -21371,9 +21544,13 @@ function addCourts$1({
|
|
|
21371
21544
|
dateAvailability = [],
|
|
21372
21545
|
tournamentRecord,
|
|
21373
21546
|
courtNames = [],
|
|
21547
|
+
courtTimings,
|
|
21374
21548
|
courtsCount,
|
|
21549
|
+
startTime,
|
|
21375
21550
|
courtIds,
|
|
21376
|
-
|
|
21551
|
+
endTime,
|
|
21552
|
+
venueId,
|
|
21553
|
+
dates
|
|
21377
21554
|
}) {
|
|
21378
21555
|
if (!venueId) return {
|
|
21379
21556
|
error: MISSING_VENUE_ID
|
|
@@ -21383,9 +21560,21 @@ function addCourts$1({
|
|
|
21383
21560
|
};
|
|
21384
21561
|
courtsCount = courtsCount || courtNames.length;
|
|
21385
21562
|
const courts = generateRange(0, courtsCount).map(i => {
|
|
21563
|
+
const courtTiming = courtTimings === null || courtTimings === void 0 ? void 0 : courtTimings[i];
|
|
21564
|
+
const courtAvailability = courtTiming ? dates.map(date => ({
|
|
21565
|
+
date: formatDate(date),
|
|
21566
|
+
startTime,
|
|
21567
|
+
endTime,
|
|
21568
|
+
...courtTiming
|
|
21569
|
+
})) : dateAvailability; // when courtTiming is provided, also add default availability
|
|
21570
|
+
|
|
21571
|
+
if (courtTiming && startTime && endTime) courtAvailability.push({
|
|
21572
|
+
startTime,
|
|
21573
|
+
endTime
|
|
21574
|
+
});
|
|
21386
21575
|
const court = {
|
|
21387
21576
|
courtName: courtNames[i] || `Court ${i + 1}`,
|
|
21388
|
-
dateAvailability
|
|
21577
|
+
dateAvailability: courtAvailability
|
|
21389
21578
|
};
|
|
21390
21579
|
return court;
|
|
21391
21580
|
});
|
|
@@ -29387,14 +29576,27 @@ const competitionEngine = function () {
|
|
|
29387
29576
|
return engine;
|
|
29388
29577
|
}
|
|
29389
29578
|
|
|
29390
|
-
function
|
|
29579
|
+
function executeFunction(tournamentRecords, method, params, methodName) {
|
|
29391
29580
|
delete engine.success;
|
|
29392
29581
|
delete engine.error;
|
|
29582
|
+
const start = Date.now();
|
|
29583
|
+
const result = method({
|
|
29584
|
+
tournamentRecords,
|
|
29585
|
+
...params
|
|
29586
|
+
});
|
|
29587
|
+
const elapsed = Date.now() - start;
|
|
29588
|
+
const devContext = getDevContext();
|
|
29589
|
+
if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('ce:', {
|
|
29590
|
+
methodName,
|
|
29591
|
+
elapsed
|
|
29592
|
+
});
|
|
29593
|
+
return result;
|
|
29594
|
+
}
|
|
29595
|
+
|
|
29596
|
+
function engineInvoke(method, params, methodName) {
|
|
29393
29597
|
const tournamentRecords = getTournamentRecords();
|
|
29394
29598
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecords, false, true);
|
|
29395
|
-
const result =
|
|
29396
|
-
tournamentRecords
|
|
29397
|
-
});
|
|
29599
|
+
const result = executeFunction(tournamentRecords, method, params, methodName);
|
|
29398
29600
|
if (result !== null && result !== void 0 && result.error && snapshot) setState$3(snapshot);
|
|
29399
29601
|
const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
|
|
29400
29602
|
if (notify) notifySubscribers();
|
|
@@ -29404,18 +29606,18 @@ const competitionEngine = function () {
|
|
|
29404
29606
|
|
|
29405
29607
|
function importGovernors(governors) {
|
|
29406
29608
|
governors.forEach(governor => {
|
|
29407
|
-
Object.keys(governor).forEach(
|
|
29408
|
-
engine[
|
|
29609
|
+
Object.keys(governor).forEach(methodName => {
|
|
29610
|
+
engine[methodName] = params => {
|
|
29409
29611
|
if (getDevContext()) {
|
|
29410
|
-
return engineInvoke(governor[
|
|
29612
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
29411
29613
|
} else {
|
|
29412
29614
|
try {
|
|
29413
|
-
return engineInvoke(governor[
|
|
29615
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
29414
29616
|
} catch (err) {
|
|
29415
29617
|
const error = err.toString();
|
|
29416
29618
|
console.log('ERROR', {
|
|
29417
29619
|
error,
|
|
29418
|
-
|
|
29620
|
+
methodName,
|
|
29419
29621
|
params: JSON.stringify(params)
|
|
29420
29622
|
});
|
|
29421
29623
|
console.log(err);
|
|
@@ -29439,15 +29641,13 @@ const competitionEngine = function () {
|
|
|
29439
29641
|
error: INVALID_VALUES
|
|
29440
29642
|
};
|
|
29441
29643
|
const {
|
|
29442
|
-
method,
|
|
29644
|
+
method: methodName,
|
|
29443
29645
|
params
|
|
29444
29646
|
} = directive;
|
|
29445
|
-
if (!engine[
|
|
29647
|
+
if (!engine[methodName]) return {
|
|
29446
29648
|
error: METHOD_NOT_FOUND
|
|
29447
29649
|
};
|
|
29448
|
-
const result = engine[
|
|
29449
|
-
tournamentRecords
|
|
29450
|
-
});
|
|
29650
|
+
const result = executeFunction(tournamentRecords, engine[methodName], params, methodName);
|
|
29451
29651
|
|
|
29452
29652
|
if (result !== null && result !== void 0 && result.error) {
|
|
29453
29653
|
if (snapshot) setState$3(snapshot);
|
|
@@ -36559,7 +36759,7 @@ function addEventEntries(params) {
|
|
|
36559
36759
|
return true;
|
|
36560
36760
|
}
|
|
36561
36761
|
|
|
36562
|
-
if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || entryStatus
|
|
36762
|
+
if (event.eventType === TEAM$1 && (participant.participantType === TEAM$1 || isUngrouped(entryStatus) && participant.participantType === INDIVIDUAL$1)) {
|
|
36563
36763
|
return true;
|
|
36564
36764
|
}
|
|
36565
36765
|
|
|
@@ -43185,8 +43385,8 @@ function checkValidEntries({
|
|
|
43185
43385
|
const enteredParticipants = participants.filter(participant => enteredParticipantIds.includes(participant.participantId));
|
|
43186
43386
|
const invalidEntries = enteredParticipants.filter(participant => {
|
|
43187
43387
|
const entryStatus = entryStatusMap[participant.participantId];
|
|
43188
|
-
const
|
|
43189
|
-
const mismatch = participant.participantType !== participantType && !
|
|
43388
|
+
const ungroupedParticipant = [DOUBLES$1, TEAM$3].includes(eventType) && participant.participantType === INDIVIDUAL$1 && (isUngrouped(entryStatus) || entryStatus === WITHDRAWN);
|
|
43389
|
+
const mismatch = participant.participantType !== participantType && !ungroupedParticipant; // TODO: implement gender checking for teams & pairs
|
|
43190
43390
|
|
|
43191
43391
|
const wrongGender = !ignoreGender && eventType === INDIVIDUAL$1 && [MALE, FEMALE].includes(eventGender) && participant.sex !== eventGender;
|
|
43192
43392
|
return mismatch || wrongGender;
|
|
@@ -43442,13 +43642,21 @@ const COLLEGE_D3 = 'COLLEGE_D3';
|
|
|
43442
43642
|
const DOMINANT_DUO = 'DOMINANT_DUO';
|
|
43443
43643
|
const LAVER_CUP = 'LAVER_CUP';
|
|
43444
43644
|
const TEAM_DOUBLES_3_AGGREGATION = 'TEAM_DOUBLES_3_AGGREGATION';
|
|
43645
|
+
const USTA_LEVEL_1 = 'USTA_LEVEL_1';
|
|
43646
|
+
const USTA_ZONAL = 'USTA_ZONAL';
|
|
43647
|
+
const USTA_INTERSECTIONAL = 'USTA_INTERSECTIONAL';
|
|
43648
|
+
const USTA_SOUTHERN_LEVEL_5 = 'USTA_SOUTHERN_LEVEL_5';
|
|
43445
43649
|
const tieFormatConstants = {
|
|
43446
43650
|
COLLEGE_D3,
|
|
43447
43651
|
COLLEGE_DEFAULT,
|
|
43448
43652
|
COLLEGE_JUCO,
|
|
43449
43653
|
DOMINANT_DUO,
|
|
43450
43654
|
LAVER_CUP,
|
|
43451
|
-
TEAM_DOUBLES_3_AGGREGATION
|
|
43655
|
+
TEAM_DOUBLES_3_AGGREGATION,
|
|
43656
|
+
USTA_LEVEL_1,
|
|
43657
|
+
USTA_ZONAL,
|
|
43658
|
+
USTA_INTERSECTIONAL,
|
|
43659
|
+
USTA_SOUTHERN_LEVEL_5
|
|
43452
43660
|
};
|
|
43453
43661
|
|
|
43454
43662
|
const namedFormats = {
|
|
@@ -47317,20 +47525,27 @@ const tournamentEngine = function () {
|
|
|
47317
47525
|
importGovernors([queryGovernor, eventGovernor, locationGovernor, policyGovernor, scheduleGovernor, publishingGovernor, tournamentGovernor, participantGovernor]);
|
|
47318
47526
|
return engine;
|
|
47319
47527
|
|
|
47320
|
-
function executeFunction(tournamentRecord, method, params) {
|
|
47528
|
+
function executeFunction(tournamentRecord, method, params, methodName) {
|
|
47321
47529
|
delete engine.success;
|
|
47322
47530
|
delete engine.error;
|
|
47531
|
+
const start = Date.now();
|
|
47323
47532
|
const augmentedParams = paramsMiddleWare(tournamentRecord, params);
|
|
47324
47533
|
const result = method({ ...augmentedParams,
|
|
47325
47534
|
tournamentRecord
|
|
47326
47535
|
});
|
|
47536
|
+
const elapsed = Date.now() - start;
|
|
47537
|
+
const devContext = getDevContext();
|
|
47538
|
+
if (devContext.perf && (isNaN(devContext.perf) || elapsed > devContext.perf)) console.log('te:', {
|
|
47539
|
+
methodName,
|
|
47540
|
+
elapsed
|
|
47541
|
+
});
|
|
47327
47542
|
return result;
|
|
47328
47543
|
}
|
|
47329
47544
|
|
|
47330
|
-
function engineInvoke(method, params) {
|
|
47545
|
+
function engineInvoke(method, params, methodName) {
|
|
47331
47546
|
const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
|
|
47332
47547
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
|
|
47333
|
-
const result = executeFunction(tournamentRecord, method, params);
|
|
47548
|
+
const result = executeFunction(tournamentRecord, method, params, methodName);
|
|
47334
47549
|
if (result !== null && result !== void 0 && result.error && snapshot) setState(snapshot);
|
|
47335
47550
|
const notify = (result === null || result === void 0 ? void 0 : result.success) && (params === null || params === void 0 ? void 0 : params.delayNotify) !== true && (params === null || params === void 0 ? void 0 : params.doNotNotify) !== true;
|
|
47336
47551
|
if (notify) notifySubscribers();
|
|
@@ -47340,18 +47555,18 @@ const tournamentEngine = function () {
|
|
|
47340
47555
|
|
|
47341
47556
|
function importGovernors(governors) {
|
|
47342
47557
|
governors.forEach(governor => {
|
|
47343
|
-
Object.keys(governor).forEach(
|
|
47344
|
-
engine[
|
|
47558
|
+
Object.keys(governor).forEach(methodName => {
|
|
47559
|
+
engine[methodName] = params => {
|
|
47345
47560
|
if (getDevContext()) {
|
|
47346
|
-
return engineInvoke(governor[
|
|
47561
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
47347
47562
|
} else {
|
|
47348
47563
|
try {
|
|
47349
|
-
return engineInvoke(governor[
|
|
47564
|
+
return engineInvoke(governor[methodName], params, methodName);
|
|
47350
47565
|
} catch (err) {
|
|
47351
47566
|
const error = err.toString();
|
|
47352
47567
|
console.log('ERROR', {
|
|
47353
47568
|
error,
|
|
47354
|
-
|
|
47569
|
+
methodName,
|
|
47355
47570
|
params: JSON.stringify(params)
|
|
47356
47571
|
});
|
|
47357
47572
|
console.log(err);
|
|
@@ -47376,13 +47591,13 @@ const tournamentEngine = function () {
|
|
|
47376
47591
|
error: INVALID_VALUES
|
|
47377
47592
|
};
|
|
47378
47593
|
const {
|
|
47379
|
-
method,
|
|
47594
|
+
method: methodName,
|
|
47380
47595
|
params
|
|
47381
47596
|
} = directive;
|
|
47382
|
-
if (!engine[
|
|
47597
|
+
if (!engine[methodName]) return {
|
|
47383
47598
|
error: METHOD_NOT_FOUND
|
|
47384
47599
|
};
|
|
47385
|
-
const result = executeFunction(tournamentRecord, engine[
|
|
47600
|
+
const result = executeFunction(tournamentRecord, engine[methodName], params, methodName);
|
|
47386
47601
|
|
|
47387
47602
|
if (result !== null && result !== void 0 && result.error) {
|
|
47388
47603
|
if (snapshot) setState(snapshot);
|
|
@@ -47473,7 +47688,7 @@ function tournamentEngineAsync(test) {
|
|
|
47473
47688
|
return result;
|
|
47474
47689
|
}
|
|
47475
47690
|
|
|
47476
|
-
async function engineInvoke(method, params) {
|
|
47691
|
+
async function engineInvoke(method, params, methodName) {
|
|
47477
47692
|
const tournamentRecord = (params === null || params === void 0 ? void 0 : params.sandBoxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxRecord) || (params === null || params === void 0 ? void 0 : params.sandboxTournament) || getTournamentRecord(getTournamentId());
|
|
47478
47693
|
const snapshot = (params === null || params === void 0 ? void 0 : params.rollbackOnError) && makeDeepCopy(tournamentRecord, false, true);
|
|
47479
47694
|
const result = await executeFunctionAsync(tournamentRecord, method, params);
|
|
@@ -47488,15 +47703,13 @@ function tournamentEngineAsync(test) {
|
|
|
47488
47703
|
for (const governor of governors) {
|
|
47489
47704
|
const governorMethods = Object.keys(governor);
|
|
47490
47705
|
|
|
47491
|
-
for (const
|
|
47492
|
-
engine[
|
|
47706
|
+
for (const methodName of governorMethods) {
|
|
47707
|
+
engine[methodName] = async params => {
|
|
47493
47708
|
if (getDevContext()) {
|
|
47494
|
-
const result = await engineInvoke(governor[
|
|
47495
|
-
);
|
|
47709
|
+
const result = await engineInvoke(governor[methodName], params);
|
|
47496
47710
|
return result;
|
|
47497
47711
|
} else {
|
|
47498
|
-
const result = await engineInvoke(governor[
|
|
47499
|
-
);
|
|
47712
|
+
const result = await engineInvoke(governor[methodName], params);
|
|
47500
47713
|
return result;
|
|
47501
47714
|
}
|
|
47502
47715
|
};
|
|
@@ -52772,6 +52985,7 @@ function generateVenues({
|
|
|
52772
52985
|
dateAvailability,
|
|
52773
52986
|
startTime = '07:00',
|
|
52774
52987
|
endTime = '19:00',
|
|
52988
|
+
courtTimings,
|
|
52775
52989
|
courtsCount,
|
|
52776
52990
|
courtNames,
|
|
52777
52991
|
venueName,
|
|
@@ -52797,10 +53011,14 @@ function generateVenues({
|
|
|
52797
53011
|
result = addCourts$1({
|
|
52798
53012
|
tournamentRecord,
|
|
52799
53013
|
dateAvailability,
|
|
53014
|
+
courtTimings,
|
|
52800
53015
|
courtsCount,
|
|
52801
53016
|
courtNames,
|
|
53017
|
+
startTime,
|
|
52802
53018
|
courtIds,
|
|
52803
|
-
|
|
53019
|
+
endTime,
|
|
53020
|
+
venueId,
|
|
53021
|
+
dates
|
|
52804
53022
|
});
|
|
52805
53023
|
if (result.error) return result;
|
|
52806
53024
|
}
|
|
@@ -53098,7 +53316,7 @@ function generateSchedulingProfile({
|
|
|
53098
53316
|
|
|
53099
53317
|
const targetRange = (winnerFinishingPositionRange === null || winnerFinishingPositionRange === void 0 ? void 0 : winnerFinishingPositionRange.indexOf('-')) > 0 && winnerFinishingPositionRange.split('-').map(x => +x);
|
|
53100
53318
|
const range = (_matchUp$finishingPos = matchUp.finishingPositionRange) === null || _matchUp$finishingPos === void 0 ? void 0 : _matchUp$finishingPos.winner;
|
|
53101
|
-
const target = matchUp.drawId === drawId && (!round.roundNumber || matchUp.roundNumber === round.roundNumber) && (!range || !targetRange || intersection(range, targetRange).length === 2);
|
|
53319
|
+
const target = matchUp.drawId === drawId && (!round.roundNumber || matchUp.roundNumber === round.roundNumber) && (!range || !targetRange || intersection(range, targetRange).length === 2 || unique(range).length === unique(targetRange).length && intersection(range, targetRange).length === unique(range).length);
|
|
53102
53320
|
return target;
|
|
53103
53321
|
});
|
|
53104
53322
|
const targetMatchUp = targetMatchUps[0];
|