Refactor TimeEntryService and StatusBox component to integrate missing break minutes into time calculations. Update logic to ensure "Offen" time reflects accurate values, including breaks, and adjust frontend display to clarify time representation without redundant pause indications. Enhance output formatting for improved clarity in time displays.
This commit is contained in:
@@ -324,6 +324,8 @@ class TimeEntryService {
|
||||
}
|
||||
|
||||
// Berechne "Offen" basierend auf timewish (oder Standard: 8 Stunden)
|
||||
// WICHTIG: Diese Zeit wird OHNE fehlende Pausen berechnet
|
||||
// Das Frontend addiert die fehlenden Pausen dann zur "Normales Arbeitsende" Berechnung
|
||||
let open = null;
|
||||
const { Timewish } = database.getModels();
|
||||
|
||||
@@ -458,6 +460,23 @@ class TimeEntryService {
|
||||
// Fehlende Pausenzeit
|
||||
const missingBreakMinutes = Math.max(0, requiredBreakMinutes - alreadyTakenBreakMinutes);
|
||||
|
||||
// Addiere fehlende Pausen zur "Offen" Zeit
|
||||
if (open && open !== '—' && open !== 'Arbeitsende erreicht') {
|
||||
const openParts = open.split(':');
|
||||
const openH = parseInt(openParts[0]);
|
||||
const openM = parseInt(openParts[1]);
|
||||
const openS = parseInt(openParts[2] || 0);
|
||||
const openMinutes = openH * 60 + openM + missingBreakMinutes;
|
||||
|
||||
const newOpenH = Math.floor(openMinutes / 60);
|
||||
const newOpenM = openMinutes % 60;
|
||||
const newOpenS = openS;
|
||||
|
||||
console.log(`🔍 DEBUG Offen-Berechnung: Original=${open}, Fehlende Pausen=${missingBreakMinutes}min, Neu=${newOpenH}:${newOpenM.toString().padStart(2, '0')}:${newOpenS.toString().padStart(2, '0')}`);
|
||||
|
||||
open = `${newOpenH.toString().padStart(2, '0')}:${newOpenM.toString().padStart(2, '0')}:${newOpenS.toString().padStart(2, '0')}`;
|
||||
}
|
||||
|
||||
// Berechne Überstunden über den gesamten Zeitraum (alle Wochen)
|
||||
// Neue Berechnung: Timewish-basiert
|
||||
const totalOvertimeResult = await this._calculateTotalOvertime(uid, runningEntry);
|
||||
|
||||
Reference in New Issue
Block a user