From a335a06edb2bcdbc6db8b3ef7e9d08d4ce8ab85c Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Mon, 20 Oct 2025 07:56:33 +0200 Subject: [PATCH] Improve logging in AuthService and TimeEntryService; add detailed console messages for login actions and error handling in AuthService, while removing redundant debug logs in TimeEntryService for cleaner output. --- backend/src/services/AuthService.js | 6 +++++- backend/src/services/TimeEntryService.js | 10 ---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/backend/src/services/AuthService.js b/backend/src/services/AuthService.js index 7332d20..651a1d3 100644 --- a/backend/src/services/AuthService.js +++ b/backend/src/services/AuthService.js @@ -224,13 +224,17 @@ class AuthService { // Führe gewünschte Aktion aus (falls angegeben und gültig) if (action && action !== '0') { + console.log(`🔔 LOGIN MIT AKTION: User ${authInfo.user.full_name} (ID ${authInfo.user.id}), Aktion: ${action}`); try { const actionWarning = await this._executeLoginAction(authInfo.user.id, action); if (actionWarning) { result.actionWarning = actionWarning; + console.log(`⚠️ Login-Aktion konnte nicht ausgeführt werden: ${actionWarning}`); + } else { + console.log(`✅ Login-Aktion erfolgreich ausgeführt`); } } catch (error) { - console.error('Fehler beim Ausführen der Login-Aktion:', error); + console.error('❌ Fehler beim Ausführen der Login-Aktion:', error); result.actionWarning = `Aktion konnte nicht ausgeführt werden: ${error.message}`; } } diff --git a/backend/src/services/TimeEntryService.js b/backend/src/services/TimeEntryService.js index 6061461..62eaf54 100644 --- a/backend/src/services/TimeEntryService.js +++ b/backend/src/services/TimeEntryService.js @@ -495,8 +495,6 @@ class TimeEntryService { const todayDate = new Date(now.getFullYear(), now.getMonth(), now.getDate()); const includeTodayInOvertime = !runningEntry; // Nur wenn heute schon abgeschlossen ist - console.log(`DEBUG Wochen-Überstunden: runningEntry=${!!runningEntry}, includeTodayInOvertime=${includeTodayInOvertime}, weekData.days.length=${weekData.days.length}`); - weekData.days.forEach(day => { // Parse day.date (YYYY-MM-DD) - mit expliziter Zeit um Midnight const dayDate = new Date(day.date + 'T00:00:00'); @@ -504,24 +502,16 @@ class TimeEntryService { const isToday = dayDateOnly.getTime() === todayDate.getTime(); - console.log(`DEBUG Wochen-Überstunden: Prüfe Tag ${day.date}, isToday=${isToday}, dayDateOnly=${dayDateOnly.toISOString()}, todayDate=${todayDate.toISOString()}, netWorkTime=${day.netWorkTime}`); - // Zukünftige Tage überspringen if (dayDateOnly > todayDate) { - console.log(`DEBUG Wochen-Überstunden: Tag ${day.date} übersprungen (Zukunft)`); return; } // Heute überspringen, wenn noch gearbeitet wird if (isToday && !includeTodayInOvertime) { - console.log(`DEBUG Wochen-Überstunden: Tag ${day.date} übersprungen (heute, noch nicht abgeschlossen)`); return; } - if (isToday && includeTodayInOvertime) { - console.log(`DEBUG Wochen-Überstunden: Tag ${day.date} WIRD GEZÄHLT (heute, abgeschlossen)`); - } - const dayOfWeek = dayDate.getDay(); // 0=So, 1=Mo, ..., 6=Sa // Nur Mo-Fr berücksichtigen