feat(ScheduleView): improve club name normalization for match home detection
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m2s
All checks were successful
Deploy tt-tagebuch / deploy (push) Successful in 1m2s
This commit is contained in:
@@ -1314,17 +1314,29 @@ export default {
|
||||
},
|
||||
|
||||
isOurClubPlayingHome(match) {
|
||||
const club = (this.currentClubName || '').toString().trim().toLowerCase();
|
||||
const normalizeClubName = (name) => String(name || '')
|
||||
.normalize('NFD')
|
||||
.replace(/[\u0300-\u036f]/g, '')
|
||||
.toLowerCase()
|
||||
// click-TT führt bei manchen Vereinen eine Jahreszahl, die im
|
||||
// hinterlegten Vereinsnamen nicht enthalten ist (z. B.
|
||||
// "TSV Bonames" / "TSV 1875 Bonames (J15)").
|
||||
.replace(/\b\d+\b/g, ' ')
|
||||
.replace(/[^\p{L}]+/gu, ' ')
|
||||
.replace(/\s+/g, ' ')
|
||||
.trim();
|
||||
|
||||
const club = normalizeClubName(this.currentClubName);
|
||||
if (!club || !match) return false;
|
||||
const homeName = (match.homeTeam?.name || '').toString().toLowerCase();
|
||||
const guestName = (match.guestTeam?.name || '').toString().toLowerCase();
|
||||
const homeHas = homeName.includes(club);
|
||||
const guestHas = guestName.includes(club);
|
||||
const homeName = normalizeClubName(match.homeTeam?.name);
|
||||
const guestName = normalizeClubName(match.guestTeam?.name);
|
||||
const belongsToClub = (teamName) => teamName === club || teamName.startsWith(`${club} `);
|
||||
const homeHas = belongsToClub(homeName);
|
||||
const guestHas = belongsToClub(guestName);
|
||||
if (homeHas && guestHas) return true; // both teams from our club -> treat as home
|
||||
if (homeHas) return true;
|
||||
if (guestHas) return false;
|
||||
// Fallback: if neither includes club name, prefer original startsWith heuristic
|
||||
return homeName.startsWith(this.currentClubName || '') || false;
|
||||
return false;
|
||||
},
|
||||
|
||||
// Dialog Helper Methods
|
||||
|
||||
Reference in New Issue
Block a user