corrected time calculation
This commit is contained in:
@@ -14,7 +14,8 @@ class MonthStart {
|
||||
});
|
||||
|
||||
/// Basis für kumulierte Differenz
|
||||
int get carryBaseMinutes => startMinutes + overtimeMinutes + correctionMinutes;
|
||||
int get carryBaseMinutes =>
|
||||
startMinutes + correctionMinutes - overtimeMinutes;
|
||||
|
||||
static MonthStart fromJson(Map<String, dynamic> json) {
|
||||
final bookings = (json['bookings'] as List?) ?? const [];
|
||||
|
||||
@@ -316,9 +316,11 @@ class _MonthlyViewState extends State<MonthlyView> {
|
||||
'T': _days.where((d) => d.code == 'T').length,
|
||||
};
|
||||
|
||||
final startMinutes = _monthStartInfo?.startMinutes ?? 0;
|
||||
final correctionMin = _monthStartInfo?.correctionMinutes ?? 0;
|
||||
final nextCarryMin =
|
||||
cumulative.isNotEmpty ? cumulative.last : _carryBaseMinutes;
|
||||
final overtimeMin = _monthStartInfo?.overtimeMinutes ?? 0;
|
||||
final saldoMin = istTotal - sollTotal;
|
||||
final nextCarryMin = startMinutes + correctionMin + saldoMin - overtimeMin;
|
||||
|
||||
final rows = List<DataRow>.generate(_days.length, (i) {
|
||||
final day = effectiveDays[i];
|
||||
@@ -438,12 +440,12 @@ class _MonthlyViewState extends State<MonthlyView> {
|
||||
_MonthlySummaryFooter(
|
||||
month: _monthStart,
|
||||
fontSize: _fontSize,
|
||||
uebertragStartText: minutesToSignedHHMM(_carryBaseMinutes),
|
||||
uebertragStartText: minutesToSignedHHMM(startMinutes),
|
||||
sollText: minutesToHHMM(sollTotal),
|
||||
istText: minutesToHHMM(istTotal),
|
||||
correctionText: minutesToSignedHHMM(correctionMin),
|
||||
saldoText: minutesToSignedHHMM(istTotal - sollTotal),
|
||||
paidOvertimeText: '—',
|
||||
saldoText: minutesToSignedHHMM(saldoMin),
|
||||
paidOvertimeText: minutesToSignedHHMM(overtimeMin),
|
||||
uebertragNextText: minutesToSignedHHMM(nextCarryMin),
|
||||
restUrlaubText: '$startVacation',
|
||||
urlaubUebertragText: '$vacationCarry',
|
||||
|
||||
@@ -26,6 +26,8 @@ int effectiveWorkedMinutes(
|
||||
|
||||
if (worked <= 6 * 60) return worked;
|
||||
|
||||
final maxRequiredBreak = (worked - 6 * 60).clamp(0, requiredBreakOver6h);
|
||||
|
||||
// Lücken summieren
|
||||
int gaps = 0;
|
||||
for (var i = 0; i < sorted.length - 1; i++) {
|
||||
@@ -33,7 +35,12 @@ int effectiveWorkedMinutes(
|
||||
if (gap > 0) gaps += gap;
|
||||
}
|
||||
|
||||
final extraBreak = (requiredBreakOver6h - gaps).clamp(0, requiredBreakOver6h);
|
||||
final extraBreak = (maxRequiredBreak - gaps).clamp(0, maxRequiredBreak);
|
||||
final effective = worked - extraBreak;
|
||||
// int effective = worked - extraBreak;
|
||||
// final diff = 30 - gaps;
|
||||
|
||||
// if (diff > 0) effective -= diff;
|
||||
|
||||
return effective < 0 ? 0 : effective;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user