feat: update pause duration logic to comply with German law based on target work hours
All checks were successful
Build and Push Docker Image / build (push) Successful in 23s
All checks were successful
Build and Push Docker Image / build (push) Successful in 23s
This commit is contained in:
@@ -401,15 +401,19 @@ function updateTimerMetrics(netElapsedSeconds) {
|
|||||||
// Target hours from user selection (default 8)
|
// Target hours from user selection (default 8)
|
||||||
const targetSeconds = targetHours * 60 * 60;
|
const targetSeconds = targetHours * 60 * 60;
|
||||||
|
|
||||||
// Calculate total pause time: 30 min after 6h + 15 min after 9h
|
// Calculate required pause time based on target hours (German law)
|
||||||
const pauseDuration30Min = 30 * 60; // 30 minutes in seconds
|
let totalPauseSeconds = 0;
|
||||||
const pauseDuration15Min = 15 * 60; // 15 minutes in seconds
|
if (targetHours > 9) {
|
||||||
|
// More than 9h -> 45 min pause (30 + 15)
|
||||||
|
totalPauseSeconds = 45 * 60;
|
||||||
|
} else if (targetHours > 6) {
|
||||||
|
// More than 6h -> 30 min pause
|
||||||
|
totalPauseSeconds = 30 * 60;
|
||||||
|
}
|
||||||
|
// 6h or less -> no mandatory pause
|
||||||
|
|
||||||
// Time needed including pauses
|
// Total gross time = target work hours + pause time
|
||||||
// After 6h work -> 30 min pause
|
const totalGrossTimeNeeded = targetSeconds + totalPauseSeconds;
|
||||||
// After 9h work -> 15 min pause
|
|
||||||
// Total gross time = target work hours + 30min pause + 15min pause
|
|
||||||
const totalGrossTimeNeeded = targetSeconds + pauseDuration30Min + pauseDuration15Min;
|
|
||||||
|
|
||||||
// Calculate when target will be reached (clock time)
|
// Calculate when target will be reached (clock time)
|
||||||
const targetReachedTimestamp = new Date(timerStartTime + totalGrossTimeNeeded * 1000);
|
const targetReachedTimestamp = new Date(timerStartTime + totalGrossTimeNeeded * 1000);
|
||||||
|
|||||||
Reference in New Issue
Block a user