feat: Implement filtering for regular matches and update related functionalities
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 48s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 48s
This commit is contained in:
@@ -827,6 +827,9 @@ export default {
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
filterRegularScheduleMatches(matches) {
|
||||
return (Array.isArray(matches) ? matches : []).filter((match) => !match?.isFriendly);
|
||||
},
|
||||
getClubNameById(clubId) {
|
||||
const club = (this.clubs || []).find((item) => Number(item.id) === Number(clubId));
|
||||
return club?.name || `Verein ${clubId}`;
|
||||
@@ -1878,7 +1881,7 @@ export default {
|
||||
}
|
||||
try {
|
||||
const ownResponse = await apiClient.get(`/matches/leagues/${this.currentClub}/matches/${team.league.id}`);
|
||||
this.ownLeagueMatches = ownResponse.data;
|
||||
this.ownLeagueMatches = this.filterRegularScheduleMatches(ownResponse.data);
|
||||
await this.loadLeagueMatches(team.league.id);
|
||||
this.applyLeagueMatchScope();
|
||||
// Lade auch die Tabellendaten für diese Liga
|
||||
@@ -1897,7 +1900,7 @@ export default {
|
||||
},
|
||||
async loadLeagueMatches(leagueId) {
|
||||
const response = await apiClient.get(`/matches/leagues/${this.currentClub}/matches/${leagueId}?scope=all`);
|
||||
this.allLeagueMatches = response.data;
|
||||
this.allLeagueMatches = this.filterRegularScheduleMatches(response.data);
|
||||
},
|
||||
getCombinedLeagueMatches() {
|
||||
const combined = [...(this.allLeagueMatches || []), ...(this.ownLeagueMatches || [])];
|
||||
@@ -1959,7 +1962,7 @@ export default {
|
||||
try {
|
||||
const seasonParam = this.selectedSeasonId ? `?seasonid=${this.selectedSeasonId}` : '';
|
||||
const response = await apiClient.get(`/matches/leagues/${this.currentClub}/matches${seasonParam}`);
|
||||
this.matches = this.sortMatchesByDateTime(response.data);
|
||||
this.matches = this.sortMatchesByDateTime(this.filterRegularScheduleMatches(response.data));
|
||||
} catch (error) {
|
||||
this.showInfo(this.$t('messages.error'), this.$t('schedule.errorLoadingOverallSchedule'), '', 'error');
|
||||
this.matches = [];
|
||||
@@ -1976,7 +1979,7 @@ export default {
|
||||
const seasonParam = this.selectedSeasonId ? `?seasonid=${this.selectedSeasonId}` : '';
|
||||
const response = await apiClient.get(`/matches/leagues/${this.currentClub}/matches${seasonParam}`);
|
||||
// Filtere nur Erwachsenenligen (keine Jugendligen)
|
||||
const allMatches = response.data;
|
||||
const allMatches = this.filterRegularScheduleMatches(response.data);
|
||||
this.matches = this.sortMatchesByDateTime(allMatches.filter(match => {
|
||||
const leagueName = match.leagueDetails?.name || '';
|
||||
// Prüfe, ob es eine Jugendliga ist (J, M, Jugend im Namen)
|
||||
@@ -2282,6 +2285,10 @@ export default {
|
||||
return;
|
||||
}
|
||||
if (payload?.match && payload.matchId != null) {
|
||||
if (payload.match.isFriendly) {
|
||||
this.matches = this.matches.filter((match) => match.id !== payload.matchId);
|
||||
return;
|
||||
}
|
||||
const idx = this.matches.findIndex(m => m.id === payload.matchId);
|
||||
if (idx !== -1) {
|
||||
this.matches.splice(idx, 1, payload.match);
|
||||
|
||||
@@ -2761,7 +2761,10 @@ export default {
|
||||
// Lade die Teilnehmer für diesen Trainingstag über die Participant-API
|
||||
const participantsResponse = await apiClient.get(`/participants/${trainingForDate.id}`);
|
||||
|
||||
const participants = participantsResponse.data;
|
||||
const allTrainingParticipants = Array.isArray(participantsResponse.data)
|
||||
? participantsResponse.data
|
||||
: [];
|
||||
const participants = allTrainingParticipants.filter(participant => participant?.attendanceStatus === 'present');
|
||||
|
||||
if (participants && participants.length > 0) {
|
||||
// Lade die Member-Details für jeden Teilnehmer
|
||||
@@ -2794,6 +2797,8 @@ export default {
|
||||
} else {
|
||||
await this.showInfo('Hinweis', 'Keine gültigen Teilnehmer im Trainingstag für dieses Datum gefunden!', '', 'info');
|
||||
}
|
||||
} else if (allTrainingParticipants.length > 0) {
|
||||
await this.showInfo('Hinweis', 'Keine anwesenden Teilnehmer im Trainingstag für dieses Datum gefunden!', '', 'info');
|
||||
} else {
|
||||
await this.showInfo('Hinweis', 'Keine Teilnehmer im Trainingstag für dieses Datum gefunden!', '', 'info');
|
||||
}
|
||||
@@ -4312,4 +4317,4 @@ tbody tr:hover:not(.active-match) {
|
||||
background-color: #6c757d;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user