feat(match-service): enhance team identification logic and update league table display
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 57s

This commit is contained in:
Torsten Schulz (local)
2026-09-11 14:45:13 +02:00
parent cc6a62a122
commit acbb6c56ee
2 changed files with 24 additions and 1 deletions

View File

@@ -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,

View File

@@ -251,7 +251,7 @@
</tr>
</thead>
<tbody>
<tr v-for="(team, index) in leagueTable" :key="team.teamId" :class="{ 'our-team': isOurTeam(team.teamName) }">
<tr v-for="(team, index) in leagueTable" :key="team.teamId" :class="{ 'our-team': team.isOwnTeam || isOurTeam(team.teamName) }">
<td>{{ index + 1 }}</td>
<td>{{ team.teamName }}</td>
<td>{{ team.matchPoints }}</td>