UbuntuandClaude Opus 5 4c823f92ca Fix lunch-break guard being skipped on same-day bookings
getAvailableTimes() overloaded $dayStartTime: it starts as the worker's
real shift start, but for same-day requests it is overwritten with the
earliest bookable slot (next 15-min block + 1 hour). The lunch-break
setup further down still read it as the shift start, so $shiftSeconds
measured the *remaining* day instead of the whole shift. Once that fell
under 6 hours, $lunchRequired went false and the guard was skipped
entirely -- every free slot was offered, including ones that leave no
room for a lunch break.

Observed on prod on 2026-08-21: at 12:17 the cutoff pushed the start to
13:30, so Kateryna's 10:00-18:00 shift measured 4.5h and a 13:30-15:30
booking was accepted even though it consumed the last possible lunch
slot. booking_process() re-validates through the same function, so the
server-side check agreed.

Capture the real shift start in $shiftStartTime before the cutoff runs,
and use it for both $shiftSeconds and the computeLunchBreak() call. The
latter also fixes a second symptom of the same overload: the lunch
window was being clamped to the cutoff rather than to the actual shift.

Verified end-to-end against pages/ajax on test: with the bug a slot that
destroys the last lunch break is offered, with the fix it is withheld.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VZv7QGLyRYwdD8NyimYbQQ
2026-08-21 11:14:18 +00:00
2025-10-04 11:38:07 +02:00
2025-10-04 11:38:07 +02:00
2025-10-04 11:38:07 +02:00
2026-06-30 10:51:39 +00:00
2025-10-04 11:38:07 +02:00
2025-10-04 11:38:07 +02:00
2025-10-04 11:38:07 +02:00
2025-10-04 11:38:07 +02:00
S
Description
No description provided
Readme
87 MiB
Languages
PHP 63.9%
CSS 20.1%
SCSS 6.7%
HTML 6.1%
JavaScript 3.1%
Other 0.1%