Berechne die Wochensumme für Arbeits- und arbeitsfreie Zeit getrennt und passe die Ausgabe entsprechend an.
All checks were successful
Deploy production / deploy (push) Successful in 39s

This commit is contained in:
Torsten Schulz (local)
2026-09-10 13:25:35 +02:00
parent 530d1e8683
commit 473ab93eb7

View File

@@ -1886,36 +1886,8 @@ class TimeEntryService {
}
});
// Berechne Wochensumme (Arbeit + Urlaub + Krankheit + Feiertage)
let totalMinutes = 0;
Object.values(dayData).forEach(day => {
// Krankheitsstunden (haben Vorrang)
if (day.sick) {
totalMinutes += day.sick.hours * 60;
} else {
// Nettoarbeitszeit
if (day.netWorkTime) {
const [hours, minutes] = day.netWorkTime.split(':').map(Number);
totalMinutes += hours * 60 + minutes;
}
// Feiertagsstunden
if (day.holiday) {
totalMinutes += day.holiday.hours * 60;
}
// Urlaubsstunden
if (day.vacation) {
totalMinutes += day.vacation.hours * 60;
}
}
});
const weekTotalHours = Math.floor(totalMinutes / 60);
const weekTotalMinutes = totalMinutes % 60;
const weekTotal = `${weekTotalHours}:${weekTotalMinutes.toString().padStart(2, '0')}`;
// Berechne nur die Arbeitszeit (ohne arbeitsfreie Tage)
// Berechne die reguläre Arbeitszeit ohne arbeitsfreie Tage. Der
// Urlaubs-/Krankheits-/Feiertagsanteil wird weiter unten separat ergänzt.
let workMinutes = 0;
Object.values(dayData).forEach(day => {
if (day.netWorkTime && !day.vacation && !day.sick && !day.holiday) {
@@ -1924,10 +1896,6 @@ class TimeEntryService {
}
});
const workHours = Math.floor(workMinutes / 60);
const workMins = workMinutes % 60;
const workTotal = `${workHours}:${workMins.toString().padStart(2, '0')}`;
// Berechne arbeitsfreie Stunden für die Woche (separat für Anzeige)
let nonWorkingMinutes = 0;
let nonWorkingDays = 0;
@@ -1967,8 +1935,15 @@ class TimeEntryService {
const nonWorkingMins = nonWorkingMinutes % 60;
const nonWorkingTotal = `${nonWorkingHours}:${nonWorkingMins.toString().padStart(2, '0')}`;
// Gesamtsumme = Arbeitszeit + arbeitsfreie Zeit
const totalAllMinutes = workMinutes + nonWorkingMinutes;
// Die Wochensumme enthält die reguläre Arbeitszeit und die Gutschrift für
// arbeitsfreie Tage. Die Gesamtsumme weist den Anteil arbeitsfreier Tage
// zusätzlich aus.
const weekTotalMinutes = workMinutes + nonWorkingMinutes;
const weekTotalHours = Math.floor(weekTotalMinutes / 60);
const weekTotalMins = weekTotalMinutes % 60;
const weekTotal = `${weekTotalHours}:${weekTotalMins.toString().padStart(2, '0')}`;
const totalAllMinutes = weekTotalMinutes + nonWorkingMinutes;
const totalAllHours = Math.floor(totalAllMinutes / 60);
const totalAllMins = totalAllMinutes % 60;
const totalAll = `${totalAllHours}:${totalAllMins.toString().padStart(2, '0')}`;
@@ -1978,7 +1953,7 @@ class TimeEntryService {
weekEnd: weekEnd.toISOString().split('T')[0],
weekOffset,
days: Object.values(dayData).sort((a, b) => a.date.localeCompare(b.date)),
weekTotal: workTotal, // Nur Arbeitszeit
weekTotal,
nonWorkingTotal,
nonWorkingDays,
nonWorkingDetails,