Enhance TimeEntryService with additional debug logging for better traceability of work time calculations. Added logs for netWorkTime and currentlyWorked to provide clearer insights into overtime and weekly totals, improving the debugging process while maintaining existing functionality.
This commit is contained in:
@@ -599,11 +599,15 @@ class TimeEntryService {
|
||||
if (day.netWorkTime) {
|
||||
const [h, m] = day.netWorkTime.split(':').map(Number);
|
||||
weekIstMinutes += h * 60 + m;
|
||||
console.log(` Tag ${day.date}: netWorkTime=${day.netWorkTime}, Soll=${daySollHours}h, Ist=${h}:${m}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Überstunden = Ist - Soll
|
||||
const overtimeMinutes = weekIstMinutes - weekSollMinutes;
|
||||
|
||||
console.log(`🔍 Wochenüberstunden: weekIst=${weekIstMinutes}min (${Math.floor(weekIstMinutes/60)}:${weekIstMinutes%60}), weekSoll=${weekSollMinutes}min (${Math.floor(weekSollMinutes/60)}:${weekSollMinutes%60}), overtime=${overtimeMinutes}min`);
|
||||
|
||||
const overtimeHours = Math.floor(Math.abs(overtimeMinutes) / 60);
|
||||
const overtimeMins = Math.abs(overtimeMinutes) % 60;
|
||||
const overtimeSign = overtimeMinutes >= 0 ? '+' : '-';
|
||||
@@ -685,14 +689,18 @@ class TimeEntryService {
|
||||
const [h, m, s] = currentlyWorked.split(':').map(Number);
|
||||
dayIstMinutes = h * 60 + m;
|
||||
weekIstMinutesTotal += dayIstMinutes;
|
||||
console.log(` HEUTE ${day.date}: currentlyWorked=${currentlyWorked}, Soll=${daySollHours}h, Ist=${h}:${m}`);
|
||||
} else if (!isToday && day.netWorkTime) {
|
||||
// Für vergangene Tage: Verwende netWorkTime
|
||||
const [h, m] = day.netWorkTime.split(':').map(Number);
|
||||
dayIstMinutes = h * 60 + m;
|
||||
weekIstMinutesTotal += dayIstMinutes;
|
||||
console.log(` Vergangener Tag ${day.date}: netWorkTime=${day.netWorkTime}, Soll=${daySollHours}h, Ist=${h}:${m}`);
|
||||
}
|
||||
});
|
||||
|
||||
console.log(`🔍 Offen für Woche: weekIstTotal=${weekIstMinutesTotal}min, weekSollTotal=${weekSollMinutesTotal}min`);
|
||||
|
||||
// Offen für Woche = Wochensoll - Wochenist (bisher)
|
||||
const openForWeekMinutes = weekSollMinutesTotal - weekIstMinutesTotal;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user