From acbb6c56eecab361b6318ec6b92563a7453beac4 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Fri, 11 Sep 2026 14:45:13 +0200 Subject: [PATCH] feat(match-service): enhance team identification logic and update league table display --- backend/services/matchService.js | 23 +++++++++++++++++++++++ frontend/src/views/ScheduleView.vue | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/backend/services/matchService.js b/backend/services/matchService.js index 8b0c8260..442c6f2a 100755 --- a/backend/services/matchService.js +++ b/backend/services/matchService.js @@ -655,6 +655,28 @@ class MatchService { order: [['id', 'ASC']] }); + // Do not rely solely on the club name for identifying our teams. + // A club can have several explicitly configured teams whose click-TT + // names differ from the club name. + const [club, configuredClubTeams] = await Promise.all([ + Club.findByPk(clubId, { attributes: ['name'] }), + ClubTeam.findAll({ + where: { clubId, leagueId }, + attributes: ['name'] + }) + ]); + const configuredTeamNames = new Set( + configuredClubTeams.map((team) => this.normalizeTeamNameForMatch(team.name)) + ); + const ownTeamIds = new Set( + teams + .filter((team) => + this.isTeamNameForClub(team.name, club?.name) || + configuredTeamNames.has(this.normalizeTeamNameForMatch(team.name)) + ) + .map((team) => team.id) + ); + // A table-points result is ranked by its balance, not just by the // number of points won: 0:0 (0) must therefore rank ahead of 0:2 // (-2), which in turn ranks ahead of 0:4 (-4). @@ -676,6 +698,7 @@ class MatchService { return { teamId: team.id, teamName: team.name, + isOwnTeam: ownTeamIds.has(team.id), setsWon: team.setsWon, setsLost: team.setsLost, matchPoints: team.matchesWon + ':' + team.matchesLost, diff --git a/frontend/src/views/ScheduleView.vue b/frontend/src/views/ScheduleView.vue index d2aab0c2..8d57b0e7 100755 --- a/frontend/src/views/ScheduleView.vue +++ b/frontend/src/views/ScheduleView.vue @@ -251,7 +251,7 @@ - + {{ index + 1 }} {{ team.teamName }} {{ team.matchPoints }}