diff --git a/package.json b/package.json index 6fb9537..d45b7df 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "harheimertc-website", - "version": "1.5.0", + "version": "1.5.1", "description": "Moderne Webseite für den Harheimer Tischtennis Club", "private": true, "type": "module", diff --git a/pages/mannschaften/[slug].vue b/pages/mannschaften/[slug].vue index f90c622..1a3ae6a 100644 --- a/pages/mannschaften/[slug].vue +++ b/pages/mannschaften/[slug].vue @@ -259,7 +259,13 @@ :class="isCurrentTeamRow(row) ? 'bg-primary-50' : 'bg-white'" > - {{ row.table_rank ?? '-' }} + {{ row.table_rank ?? '-' }} {{ row.team_name || '-' }} diff --git a/server/utils/spielklassen-tables-import.js b/server/utils/spielklassen-tables-import.js index 54bf2eb..7d5c746 100644 --- a/server/utils/spielklassen-tables-import.js +++ b/server/utils/spielklassen-tables-import.js @@ -136,13 +136,19 @@ function sanitizeSeasonSlug(value) { return /^\d{2}--\d{2}$/.test(seasonSlug) ? seasonSlug : null } -async function resolveMannschaftenCsvPath() { - const candidates = [ - getServerDataPath('public-data', 'mannschaften.csv'), - getServerDataPath('mannschaften.csv'), - getProjectPath('.output', 'public', 'data', 'mannschaften.csv'), - getProjectPath('public', 'data', 'mannschaften.csv') - ] +async function resolveMannschaftenCsvPath(seasonSlug) { + const seasonalName = sanitizeSeasonSlug(seasonSlug) ? `mannschaften_${seasonSlug}.csv` : null + const fileNames = seasonalName ? [seasonalName, 'mannschaften.csv'] : ['mannschaften.csv'] + + const candidates = [] + for (const fileName of fileNames) { + candidates.push( + getServerDataPath('public-data', fileName), + getServerDataPath(fileName), + getProjectPath('.output', 'public', 'data', fileName), + getProjectPath('public', 'data', fileName) + ) + } for (const candidate of candidates) { if (await fileExists(candidate)) return candidate @@ -204,7 +210,7 @@ async function fetchTable(url) { export async function importLeagueTables(options = {}) { const today = options.today ?? new Date() const season = getSpieljahrForDate(today) - const csvPath = await resolveMannschaftenCsvPath() + const csvPath = await resolveMannschaftenCsvPath(season.seasonSlug) const csvContent = await fs.readFile(csvPath, 'utf8') const teams = extractRowsWithTableUrl(csvContent)