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
All checks were successful
Deploy production / deploy (push) Successful in 39s
This commit is contained in:
@@ -1886,36 +1886,8 @@ class TimeEntryService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Berechne Wochensumme (Arbeit + Urlaub + Krankheit + Feiertage)
|
// Berechne die reguläre Arbeitszeit ohne arbeitsfreie Tage. Der
|
||||||
let totalMinutes = 0;
|
// Urlaubs-/Krankheits-/Feiertagsanteil wird weiter unten separat ergänzt.
|
||||||
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)
|
|
||||||
let workMinutes = 0;
|
let workMinutes = 0;
|
||||||
Object.values(dayData).forEach(day => {
|
Object.values(dayData).forEach(day => {
|
||||||
if (day.netWorkTime && !day.vacation && !day.sick && !day.holiday) {
|
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)
|
// Berechne arbeitsfreie Stunden für die Woche (separat für Anzeige)
|
||||||
let nonWorkingMinutes = 0;
|
let nonWorkingMinutes = 0;
|
||||||
let nonWorkingDays = 0;
|
let nonWorkingDays = 0;
|
||||||
@@ -1967,8 +1935,15 @@ class TimeEntryService {
|
|||||||
const nonWorkingMins = nonWorkingMinutes % 60;
|
const nonWorkingMins = nonWorkingMinutes % 60;
|
||||||
const nonWorkingTotal = `${nonWorkingHours}:${nonWorkingMins.toString().padStart(2, '0')}`;
|
const nonWorkingTotal = `${nonWorkingHours}:${nonWorkingMins.toString().padStart(2, '0')}`;
|
||||||
|
|
||||||
// Gesamtsumme = Arbeitszeit + arbeitsfreie Zeit
|
// Die Wochensumme enthält die reguläre Arbeitszeit und die Gutschrift für
|
||||||
const totalAllMinutes = workMinutes + nonWorkingMinutes;
|
// 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 totalAllHours = Math.floor(totalAllMinutes / 60);
|
||||||
const totalAllMins = totalAllMinutes % 60;
|
const totalAllMins = totalAllMinutes % 60;
|
||||||
const totalAll = `${totalAllHours}:${totalAllMins.toString().padStart(2, '0')}`;
|
const totalAll = `${totalAllHours}:${totalAllMins.toString().padStart(2, '0')}`;
|
||||||
@@ -1978,7 +1953,7 @@ class TimeEntryService {
|
|||||||
weekEnd: weekEnd.toISOString().split('T')[0],
|
weekEnd: weekEnd.toISOString().split('T')[0],
|
||||||
weekOffset,
|
weekOffset,
|
||||||
days: Object.values(dayData).sort((a, b) => a.date.localeCompare(b.date)),
|
days: Object.values(dayData).sort((a, b) => a.date.localeCompare(b.date)),
|
||||||
weekTotal: workTotal, // Nur Arbeitszeit
|
weekTotal,
|
||||||
nonWorkingTotal,
|
nonWorkingTotal,
|
||||||
nonWorkingDays,
|
nonWorkingDays,
|
||||||
nonWorkingDetails,
|
nonWorkingDetails,
|
||||||
|
|||||||
Reference in New Issue
Block a user