fix(tournament): filter final placements by class group count in TournamentPlacementsTab
- Introduced a new computed property to filter final placements, ensuring only classes with more than one group are displayed. - Updated the template to reference the filtered placements, improving the clarity of the displayed tournament results. - Adjusted logic for handling class IDs to ensure proper grouping and display of placements.
This commit is contained in:
@@ -7,9 +7,9 @@
|
||||
:selected-date="selectedDate"
|
||||
@update:modelValue="$emit('update:selectedViewClass', $event)"
|
||||
/>
|
||||
<section v-if="Object.keys(finalPlacementsByClass).length > 0" class="final-placements">
|
||||
<section v-if="Object.keys(finalPlacementsByClassFiltered).length > 0" class="final-placements">
|
||||
<h3>{{ $t('tournaments.finalPlacements') }}</h3>
|
||||
<template v-for="(classPlacements, classId) in finalPlacementsByClass" :key="`final-${classId}`">
|
||||
<template v-for="(classPlacements, classId) in finalPlacementsByClassFiltered" :key="`final-${classId}`">
|
||||
<div v-if="isAllSelected || shouldShowClass(classId==='null'?null:Number(classId))" class="class-section">
|
||||
<h4 class="class-header">
|
||||
{{ getClassName(classId) }}
|
||||
@@ -86,7 +86,7 @@
|
||||
</div>
|
||||
</template>
|
||||
</section>
|
||||
<div v-if="Object.keys(finalPlacementsByClass).length === 0 && groupPlacements.length === 0" class="no-placements">
|
||||
<div v-if="Object.keys(finalPlacementsByClassFiltered).length === 0 && groupPlacements.length === 0" class="no-placements">
|
||||
<p>{{ $t('tournaments.noPlacementsYet') }}</p>
|
||||
</div>
|
||||
|
||||
@@ -470,13 +470,25 @@ export default {
|
||||
groupPlacementsByClass() {
|
||||
const grouped = {};
|
||||
this.groupPlacements.forEach(p => {
|
||||
const key = p.classId || 'null';
|
||||
const key = p.classId != null ? String(p.classId) : 'null';
|
||||
if (!grouped[key]) {
|
||||
grouped[key] = [];
|
||||
}
|
||||
grouped[key].push(p);
|
||||
});
|
||||
return grouped;
|
||||
},
|
||||
/** Endplatzierung nur anzeigen, wenn die Klasse mehr als 1 Gruppe hat (Endrunde nach Gruppenphase). */
|
||||
finalPlacementsByClassFiltered() {
|
||||
const raw = this.finalPlacementsByClass;
|
||||
const filtered = {};
|
||||
for (const [classKey, placements] of Object.entries(raw)) {
|
||||
const groupCount = (this.groupPlacementsByClass[classKey] || []).length;
|
||||
if (groupCount > 1) {
|
||||
filtered[classKey] = placements;
|
||||
}
|
||||
}
|
||||
return filtered;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
Reference in New Issue
Block a user