feat(TournamentService, TournamentConfigTab): enhance tournament advancement logic and knockout stage handling

- Introduced a new function to compare advancement candidates based on multiple criteria, improving the selection process for tournament participants.
- Updated participant data structure to include additional metrics for better ranking and comparison.
- Enhanced the TournamentConfigTab to automatically configure knockout stage settings when applicable, ensuring a smoother user experience during tournament setup.
This commit is contained in:
Torsten Schulz (local)
2026-03-28 11:09:40 +01:00
parent adefb120c0
commit 7fdbe85d3c
2 changed files with 106 additions and 8 deletions

View File

@@ -667,6 +667,29 @@ export default {
highlightedRuleTimer: null,
};
},
watch: {
'stageConfig.finalStageType': {
immediate: true,
handler(newValue) {
if (newValue === 'knockout' && this.stageConfig.poolsFinal.length === 0) {
this.stageConfig.poolsFinal = [{
fromPlacesText: '1,2',
targetType: 'knockout',
targetGroupCount: 1,
}];
}
}
},
'stageConfig.useIntermediateStage'() {
if (this.stageConfig.finalStageType === 'knockout' && this.stageConfig.poolsFinal.length === 0) {
this.stageConfig.poolsFinal = [{
fromPlacesText: '1,2',
targetType: 'knockout',
targetGroupCount: 1,
}];
}
}
},
computed: {
finalPools() {
return this.stageConfig.poolsFinal;
@@ -1789,6 +1812,14 @@ export default {
targetGroupCount: p?.target?.groupCount || this.stageConfig.finalStageGroupCount || 1,
}));
if (this.stageConfig.finalStageType === 'knockout' && this.stageConfig.poolsFinal.length === 0) {
this.stageConfig.poolsFinal = [{
fromPlacesText: '1,2',
targetType: 'knockout',
targetGroupCount: 1,
}];
}
// KO-Flag gilt für die gesamte Endrunde: true, sobald irgendeine Final-KO-Regel thirdPlace=true hat.
this.stageConfig.finalStageThirdPlace = poolsFinal.some(p => p?.target?.type === 'knockout' && p?.target?.thirdPlace === true);
} catch (e) {
@@ -1837,7 +1868,9 @@ export default {
? this.buildPoolsPayload(this.stageConfig.pools12, this.stageConfig.stage2GroupCount || 2, false)
: [];
const poolsFinal = this.buildPoolsPayload(
this.stageConfig.poolsFinal,
this.stageConfig.finalStageType === 'knockout' && this.stageConfig.poolsFinal.length === 0
? [{ fromPlacesText: '1,2', targetType: 'knockout', targetGroupCount: 1 }]
: this.stageConfig.poolsFinal,
this.stageConfig.finalStageGroupCount || 1,
true,
this.stageConfig.finalStageThirdPlace === true