diff --git a/backend/services/matchService.js b/backend/services/matchService.js index 3bb3deb..ffb0aab 100644 --- a/backend/services/matchService.js +++ b/backend/services/matchService.js @@ -31,7 +31,7 @@ class MatchService { const matches = []; try { const fileStream = fs.createReadStream(filePath) - .pipe(iconv.decodeStream('ISO-8859-15')) + .pipe(iconv.decodeStream('utf8')) .pipe(csv({ separator: ';' })); for await (const row of fileStream) { const parsedDate = parse(row['Termin'], 'dd.MM.yyyy HH:mm', new Date()); @@ -67,15 +67,11 @@ class MatchService { clubId: clubId, }); } + let season = null; if (seasonString) { - const season = await Season.findOne({ where: { season: seasonString } }); + season = await Season.findOne({ where: { season: seasonString } }); if (season) { - await Match.destroy({ - where: { - clubId: clubId, - seasonId: season.id, - } - }); + await Match.destroy({ where: { clubId, seasonId: season.id } }); } } const result = await Match.bulkCreate(matches);