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.
This commit is contained in:
@@ -224,13 +224,17 @@ class AuthService {
|
|||||||
|
|
||||||
// Führe gewünschte Aktion aus (falls angegeben und gültig)
|
// Führe gewünschte Aktion aus (falls angegeben und gültig)
|
||||||
if (action && action !== '0') {
|
if (action && action !== '0') {
|
||||||
|
console.log(`🔔 LOGIN MIT AKTION: User ${authInfo.user.full_name} (ID ${authInfo.user.id}), Aktion: ${action}`);
|
||||||
try {
|
try {
|
||||||
const actionWarning = await this._executeLoginAction(authInfo.user.id, action);
|
const actionWarning = await this._executeLoginAction(authInfo.user.id, action);
|
||||||
if (actionWarning) {
|
if (actionWarning) {
|
||||||
result.actionWarning = actionWarning;
|
result.actionWarning = actionWarning;
|
||||||
|
console.log(`⚠️ Login-Aktion konnte nicht ausgeführt werden: ${actionWarning}`);
|
||||||
|
} else {
|
||||||
|
console.log(`✅ Login-Aktion erfolgreich ausgeführt`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} 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}`;
|
result.actionWarning = `Aktion konnte nicht ausgeführt werden: ${error.message}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -495,8 +495,6 @@ class TimeEntryService {
|
|||||||
const todayDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
const todayDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
|
||||||
const includeTodayInOvertime = !runningEntry; // Nur wenn heute schon abgeschlossen ist
|
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 => {
|
weekData.days.forEach(day => {
|
||||||
// Parse day.date (YYYY-MM-DD) - mit expliziter Zeit um Midnight
|
// Parse day.date (YYYY-MM-DD) - mit expliziter Zeit um Midnight
|
||||||
const dayDate = new Date(day.date + 'T00:00:00');
|
const dayDate = new Date(day.date + 'T00:00:00');
|
||||||
@@ -504,24 +502,16 @@ class TimeEntryService {
|
|||||||
|
|
||||||
const isToday = dayDateOnly.getTime() === todayDate.getTime();
|
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
|
// Zukünftige Tage überspringen
|
||||||
if (dayDateOnly > todayDate) {
|
if (dayDateOnly > todayDate) {
|
||||||
console.log(`DEBUG Wochen-Überstunden: Tag ${day.date} übersprungen (Zukunft)`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Heute überspringen, wenn noch gearbeitet wird
|
// Heute überspringen, wenn noch gearbeitet wird
|
||||||
if (isToday && !includeTodayInOvertime) {
|
if (isToday && !includeTodayInOvertime) {
|
||||||
console.log(`DEBUG Wochen-Überstunden: Tag ${day.date} übersprungen (heute, noch nicht abgeschlossen)`);
|
|
||||||
return;
|
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
|
const dayOfWeek = dayDate.getDay(); // 0=So, 1=Mo, ..., 6=Sa
|
||||||
|
|
||||||
// Nur Mo-Fr berücksichtigen
|
// Nur Mo-Fr berücksichtigen
|
||||||
|
|||||||
Reference in New Issue
Block a user