@dcrackel/hematournamentui 1.0.421 → 1.0.424
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/HemaTournamentUI-lib.es.js +37 -14
- package/dist/HemaTournamentUI-lib.umd.js +18 -18
- package/package.json +1 -1
- package/src/mocks/getPoolResults.js +0 -8
- package/src/stories/Organisms/Containers/PoolResults/PoolResultsTable.vue +3 -8
- package/src/stories/Templates/EventManagement/PoolManagement/PoolManagement.vue +1 -1
- package/src/stories/Templates/EventManagement/PoolResults/PoolResults.stories.js +6 -10
- package/src/stories/Templates/EventManagement/PoolResults/PoolResults.vue +72 -14
- package/src/stories/Templates/Menus/Admin/AdminLeftMenu.vue +1 -0
package/package.json
CHANGED
|
@@ -116,7 +116,6 @@ const getPoolResults =
|
|
|
116
116
|
{
|
|
117
117
|
"PersonId": 37,
|
|
118
118
|
"DisplayName": "Brian Thiessen",
|
|
119
|
-
"PoolId": 225,
|
|
120
119
|
"Image": null,
|
|
121
120
|
"Club": "Steelhead Western Martial Arts",
|
|
122
121
|
"ShowData": true,
|
|
@@ -135,7 +134,6 @@ const getPoolResults =
|
|
|
135
134
|
{
|
|
136
135
|
"PersonId": 10,
|
|
137
136
|
"DisplayName": "Melissa Jones",
|
|
138
|
-
"PoolId": 224,
|
|
139
137
|
"Image": "https://randomuser.me/api/portraits/women/9.jpg",
|
|
140
138
|
"Club": "Guardians of the Guard",
|
|
141
139
|
"ShowData": true,
|
|
@@ -154,7 +152,6 @@ const getPoolResults =
|
|
|
154
152
|
{
|
|
155
153
|
"PersonId": 68,
|
|
156
154
|
"DisplayName": "Regina Mendicino",
|
|
157
|
-
"PoolId": 224,
|
|
158
155
|
"Image": null,
|
|
159
156
|
"Club": "Columbus United Fencing Club",
|
|
160
157
|
"ShowData": true,
|
|
@@ -173,7 +170,6 @@ const getPoolResults =
|
|
|
173
170
|
{
|
|
174
171
|
"PersonId": 111,
|
|
175
172
|
"DisplayName": "Aaron Senteney",
|
|
176
|
-
"PoolId": 225,
|
|
177
173
|
"Image": null,
|
|
178
174
|
"Club": "Steelhead Western Martial Arts",
|
|
179
175
|
"ShowData": true,
|
|
@@ -192,7 +188,6 @@ const getPoolResults =
|
|
|
192
188
|
{
|
|
193
189
|
"PersonId": 49,
|
|
194
190
|
"DisplayName": "Jack Seyler",
|
|
195
|
-
"PoolId": 224,
|
|
196
191
|
"Image": null,
|
|
197
192
|
"Club": "Ars Gladii",
|
|
198
193
|
"ShowData": true,
|
|
@@ -211,7 +206,6 @@ const getPoolResults =
|
|
|
211
206
|
{
|
|
212
207
|
"PersonId": 80,
|
|
213
208
|
"DisplayName": "Robin Steele ",
|
|
214
|
-
"PoolId": 224,
|
|
215
209
|
"Image": null,
|
|
216
210
|
"Club": "Hilt and Helm Pittsburgh Fencing Club",
|
|
217
211
|
"ShowData": true,
|
|
@@ -230,7 +224,6 @@ const getPoolResults =
|
|
|
230
224
|
{
|
|
231
225
|
"PersonId": 102,
|
|
232
226
|
"DisplayName": "Team Ronin",
|
|
233
|
-
"PoolId": 225,
|
|
234
227
|
"Image": null,
|
|
235
228
|
"Club": "Columbus United Fencing Club",
|
|
236
229
|
"ShowData": true,
|
|
@@ -249,7 +242,6 @@ const getPoolResults =
|
|
|
249
242
|
{
|
|
250
243
|
"PersonId": 41,
|
|
251
244
|
"DisplayName": "David Reddy",
|
|
252
|
-
"PoolId": 225,
|
|
253
245
|
"Image": null,
|
|
254
246
|
"Club": "Gem City Duelists Society",
|
|
255
247
|
"ShowData": true,
|
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
</section>
|
|
13
13
|
|
|
14
14
|
<div v-if="shouldShowResults" v-for="(person, index) in results" :key="person.personId" class="flex flex-col py-1">
|
|
15
|
-
<!-- Person Card -->
|
|
16
15
|
<FencerPoolResultsCard
|
|
17
16
|
:isLast="index === results.length - 1"
|
|
18
17
|
:person="person"
|
|
@@ -83,13 +82,6 @@ export default {
|
|
|
83
82
|
}
|
|
84
83
|
},
|
|
85
84
|
watch: {
|
|
86
|
-
numPromoted() {
|
|
87
|
-
this.updatePromotions();
|
|
88
|
-
},
|
|
89
|
-
poolResults(newResults) {
|
|
90
|
-
this.results = newResults;
|
|
91
|
-
this.updatePromotions();
|
|
92
|
-
},
|
|
93
85
|
initialCutoffIndex(newValue) {
|
|
94
86
|
this.cutoffIndex = newValue - 1;
|
|
95
87
|
this.updatePromotions();
|
|
@@ -100,6 +92,9 @@ export default {
|
|
|
100
92
|
return this.event.Status && ["live", "results", "de", "completed"].includes(this.event.Status.toLowerCase());
|
|
101
93
|
}
|
|
102
94
|
},
|
|
95
|
+
mounted() {
|
|
96
|
+
this.updatePromotions();
|
|
97
|
+
},
|
|
103
98
|
methods: {
|
|
104
99
|
moveUp() {
|
|
105
100
|
if (this.cutoffIndex > 1) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import EditEvents from './PoolResults.vue';
|
|
2
2
|
import getPoolResults from '../../../../mocks/getPoolResults.js';
|
|
3
|
-
import eventPersonGetPoolAssignmentEvent from '../../../../mocks/eventPersonGetPoolAssignmentEvent.js';
|
|
3
|
+
//import eventPersonGetPoolAssignmentEvent from '../../../../mocks/eventPersonGetPoolAssignmentEvent.js';
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
6
|
title: 'Templates/EventManagement/PoolResults',
|
|
7
7
|
component: EditEvents,
|
|
8
8
|
tags: ['autodocs'],
|
|
9
9
|
args: {
|
|
10
|
-
event:
|
|
10
|
+
event: getPoolResults,
|
|
11
11
|
rules: getPoolResults.eventRules,
|
|
12
12
|
poolResults: getPoolResults.report
|
|
13
13
|
},
|
|
@@ -20,39 +20,35 @@ export default {
|
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
let modifiedEvent = {...
|
|
23
|
+
let modifiedEvent = {...getPoolResults, Status: "results"}
|
|
24
24
|
export const Default = {
|
|
25
25
|
args: {
|
|
26
26
|
event: modifiedEvent,
|
|
27
|
-
rules: getPoolResults.eventRules,
|
|
28
27
|
poolResults: getPoolResults.report
|
|
29
28
|
}
|
|
30
29
|
};
|
|
31
30
|
|
|
32
|
-
modifiedEvent = {...
|
|
31
|
+
modifiedEvent = {...getPoolResults, Status: "de"}
|
|
33
32
|
export const EventIsInDE = {
|
|
34
33
|
args: {
|
|
35
34
|
event: modifiedEvent,
|
|
36
|
-
rules: getPoolResults.eventRules,
|
|
37
35
|
poolResults: getPoolResults.report
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
38
|
|
|
41
39
|
|
|
42
|
-
modifiedEvent = {...
|
|
40
|
+
modifiedEvent = {...getPoolResults, Status: "planning"}
|
|
43
41
|
export const EventIsInPlanning = {
|
|
44
42
|
args: {
|
|
45
43
|
event: modifiedEvent,
|
|
46
|
-
rules: getPoolResults.eventRules,
|
|
47
44
|
poolResults: getPoolResults.report
|
|
48
45
|
}
|
|
49
46
|
};
|
|
50
47
|
|
|
51
|
-
modifiedEvent = {...
|
|
48
|
+
modifiedEvent = {...getPoolResults, Status: "planning"}
|
|
52
49
|
export const noResults = {
|
|
53
50
|
args: {
|
|
54
51
|
event: modifiedEvent,
|
|
55
|
-
rules: getPoolResults.eventRules,
|
|
56
52
|
poolResults: []
|
|
57
53
|
}
|
|
58
54
|
};
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
@update:handleIncreaseCount="handleIncreaseCount"
|
|
8
8
|
@update:handleDecreaseCount="handleDecreaseCount"
|
|
9
9
|
/>
|
|
10
|
-
|
|
11
10
|
<PoolResultsTable :poolResults="localPoolResults"
|
|
12
11
|
:initialCutoffIndex="initialCutoffIndex"
|
|
13
12
|
:numPromoted="promoted"
|
|
@@ -53,10 +52,6 @@ export default {
|
|
|
53
52
|
type: Object,
|
|
54
53
|
required: true
|
|
55
54
|
},
|
|
56
|
-
rules: {
|
|
57
|
-
type: Object,
|
|
58
|
-
required: true
|
|
59
|
-
},
|
|
60
55
|
poolResults: {
|
|
61
56
|
type: Array,
|
|
62
57
|
required: true
|
|
@@ -92,6 +87,9 @@ export default {
|
|
|
92
87
|
}
|
|
93
88
|
},
|
|
94
89
|
computed: {
|
|
90
|
+
rules() {
|
|
91
|
+
return this.event?.eventRules || [];
|
|
92
|
+
},
|
|
95
93
|
promotedByRule() {
|
|
96
94
|
const rule = this.rules?.find((n2) => n2.Rules.RuleName === "DEPromoteBy");
|
|
97
95
|
return rule ? rule.RuleValue : "Percent";
|
|
@@ -105,31 +103,33 @@ export default {
|
|
|
105
103
|
handleTabMenuClick(value) {
|
|
106
104
|
this.$emit('tab:menu-click', value);
|
|
107
105
|
},
|
|
108
|
-
handleIncreaseCount(value){
|
|
109
|
-
let numPercent = this.getNumericValue(value)
|
|
106
|
+
handleIncreaseCount(value) {
|
|
107
|
+
let numPercent = this.getNumericValue(value);
|
|
110
108
|
if (this.promotedByRule === 'Top') {
|
|
111
109
|
const rule = this.rules.find(rule => rule.Rules.RuleName === "DENumOfPromotion");
|
|
112
110
|
if (rule) {
|
|
113
111
|
rule.RuleValue++;
|
|
114
112
|
console.log(rule.RuleValue);
|
|
113
|
+
this.updatePromotions(); // Centralized logic
|
|
115
114
|
}
|
|
116
115
|
return;
|
|
117
116
|
}
|
|
118
117
|
|
|
119
118
|
if (numPercent === 100) {
|
|
120
119
|
this.initialCutoffIndex = 500;
|
|
121
|
-
return
|
|
120
|
+
return;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
this.calculateInitialCutoffIndex(numPercent+10)
|
|
123
|
+
this.calculateInitialCutoffIndex(numPercent + 10);
|
|
125
124
|
},
|
|
126
|
-
handleDecreaseCount(value){
|
|
127
|
-
let numPercent = this.getNumericValue(value)
|
|
125
|
+
handleDecreaseCount(value) {
|
|
126
|
+
let numPercent = this.getNumericValue(value);
|
|
128
127
|
if (this.promotedByRule === 'Top') {
|
|
129
128
|
const rule = this.rules.find(rule => rule.Rules.RuleName === "DENumOfPromotion");
|
|
130
129
|
if (rule) {
|
|
131
130
|
rule.RuleValue--;
|
|
132
131
|
console.log(rule.RuleValue);
|
|
132
|
+
this.updatePromotions(); // Centralized logic
|
|
133
133
|
}
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
@@ -138,7 +138,7 @@ export default {
|
|
|
138
138
|
return;
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
this.calculateInitialCutoffIndex(numPercent-10)
|
|
141
|
+
this.calculateInitialCutoffIndex(numPercent - 10);
|
|
142
142
|
},
|
|
143
143
|
getNumericValue(percent) {
|
|
144
144
|
let numPercent;
|
|
@@ -154,10 +154,68 @@ export default {
|
|
|
154
154
|
return numPercent
|
|
155
155
|
},
|
|
156
156
|
calculateInitialCutoffIndex(numPercent) {
|
|
157
|
+
if (this.promotedByRule === 'Top') {
|
|
158
|
+
const numPromoted = parseInt(this.promoted, 10) || 2;
|
|
159
|
+
this.updatePromotions(numPromoted); // Centralized logic
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
|
|
157
163
|
const totalFencers = this.poolResults.length;
|
|
158
|
-
const promotionRate =
|
|
159
|
-
this.promoted = `${numPercent}
|
|
164
|
+
const promotionRate = numPercent / 100;
|
|
165
|
+
this.promoted = `${numPercent}%`;
|
|
160
166
|
this.initialCutoffIndex = Math.ceil(totalFencers * promotionRate);
|
|
167
|
+
|
|
168
|
+
this.updatePromotions(this.initialCutoffIndex); // Centralized logic
|
|
169
|
+
},
|
|
170
|
+
updatePromotions(numPromoted = parseInt(this.promoted, 10) || 2) {
|
|
171
|
+
const pools = this.groupFencersByPool(this.poolResults);
|
|
172
|
+
|
|
173
|
+
Object.entries(pools).forEach(([poolFencers]) => {
|
|
174
|
+
// Sort by criteria
|
|
175
|
+
this.sortFencersByCriteria(poolFencers);
|
|
176
|
+
// Mark top fencers as promoted
|
|
177
|
+
this.markTopFencers(poolFencers, numPromoted);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
console.log('Final Pool Results After Promotion:', this.poolResults);
|
|
181
|
+
},
|
|
182
|
+
groupFencersByPool(poolResults) {
|
|
183
|
+
return poolResults.reduce((acc, person) => {
|
|
184
|
+
const poolKey = person.PoolId || person.PoolName; // Use PoolId if available
|
|
185
|
+
if (!acc[poolKey]) acc[poolKey] = [];
|
|
186
|
+
acc[poolKey].push(person);
|
|
187
|
+
return acc;
|
|
188
|
+
}, {});
|
|
189
|
+
},
|
|
190
|
+
sortFencersByCriteria(poolFencers) {
|
|
191
|
+
// Validate input
|
|
192
|
+
if (!Array.isArray(poolFencers)) {
|
|
193
|
+
console.error('Invalid input to sortFencersByCriteria:', poolFencers);
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// Return a sorted copy of the array
|
|
198
|
+
return [...poolFencers].sort((a, b) => {
|
|
199
|
+
// Primary: Win Percentage (Descending)
|
|
200
|
+
if (b.WinPercentage !== a.WinPercentage) {
|
|
201
|
+
return b.WinPercentage - a.WinPercentage;
|
|
202
|
+
}
|
|
203
|
+
// Secondary: Total Wins (Descending)
|
|
204
|
+
if (b.TotalWins !== a.TotalWins) {
|
|
205
|
+
return b.TotalWins - a.TotalWins;
|
|
206
|
+
}
|
|
207
|
+
// Tertiary: Indicator (Descending)
|
|
208
|
+
if (b.Indicator !== a.Indicator) {
|
|
209
|
+
return b.Indicator - a.Indicator;
|
|
210
|
+
}
|
|
211
|
+
// Quaternary: Total Scored (Descending)
|
|
212
|
+
return b.PointsScored - a.PointsScored;
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
markTopFencers(poolFencers, numPromoted) {
|
|
216
|
+
poolFencers.forEach((person, index) => {
|
|
217
|
+
person.Promoted = index < numPromoted;
|
|
218
|
+
});
|
|
161
219
|
},
|
|
162
220
|
closeModal(){
|
|
163
221
|
this.showRemoveModal = false
|