fix: add split-lunch detection with formatted time range warnings
CI / Env docs check (push) Successful in 29s
CI / Frontend deps check (push) Failing after 27s
CI / Knip (push) Has been skipped
CI / Frontend a11y check (push) Has been skipped
CI / Docker compose check (push) Successful in 20s
CI / Nginx config check (push) Successful in 43s
CI / Frontend major deps (push) Failing after 52s
CI / Go build (push) Successful in 1m5s
CI / Secrets scan (push) Successful in 1m8s
CI / Frontend build (push) Successful in 53s
CI / Svelte strict check (push) Has been skipped
CI / Frontend QC (audit) (push) Has been skipped
CI / Frontend QC (typecheck) (push) Has been skipped
CI / Frontend QC (lint) (push) Has been skipped
CI / go mod tidy (push) Successful in 1m17s
CI / Go vet (dev) (push) Successful in 1m47s
CI / Go vet (prod) (push) Successful in 2m2s
CI / Go vulnerabilities (push) Successful in 1m24s
CI / Staticcheck (prod) (push) Successful in 2m54s
CI / Staticcheck (dev) (push) Successful in 3m4s
CI / golangci-lint (push) Successful in 3m24s
CI / Security scan (prod) (push) Successful in 4m29s
CI / Security scan (dev) (push) Successful in 4m29s
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled
CI / Env docs check (push) Successful in 29s
CI / Frontend deps check (push) Failing after 27s
CI / Knip (push) Has been skipped
CI / Frontend a11y check (push) Has been skipped
CI / Docker compose check (push) Successful in 20s
CI / Nginx config check (push) Successful in 43s
CI / Frontend major deps (push) Failing after 52s
CI / Go build (push) Successful in 1m5s
CI / Secrets scan (push) Successful in 1m8s
CI / Frontend build (push) Successful in 53s
CI / Svelte strict check (push) Has been skipped
CI / Frontend QC (audit) (push) Has been skipped
CI / Frontend QC (typecheck) (push) Has been skipped
CI / Frontend QC (lint) (push) Has been skipped
CI / go mod tidy (push) Successful in 1m17s
CI / Go vet (dev) (push) Successful in 1m47s
CI / Go vet (prod) (push) Successful in 2m2s
CI / Go vulnerabilities (push) Successful in 1m24s
CI / Staticcheck (prod) (push) Successful in 2m54s
CI / Staticcheck (dev) (push) Successful in 3m4s
CI / golangci-lint (push) Successful in 3m24s
CI / Security scan (prod) (push) Successful in 4m29s
CI / Security scan (dev) (push) Successful in 4m29s
CI / Tests (prod) (push) Has been cancelled
CI / Tests (dev) (push) Has been cancelled
CI / Race (prod) (push) Has been cancelled
CI / Race (dev) (push) Has been cancelled
This commit is contained in:
@@ -212,6 +212,21 @@ export function getLunchProtectionForSlots(
|
|||||||
|
|
||||||
if (isAdmin) {
|
if (isAdmin) {
|
||||||
if (gapWith < 30) {
|
if (gapWith < 30) {
|
||||||
|
const gapWasBelow30 = gapsWith.length > 1;
|
||||||
|
if (gapWasBelow30) {
|
||||||
|
const gapsWithout = findAllLunchGaps(windowStart, windowEnd, existingBookings);
|
||||||
|
const gapWithout = gapsWithout[0] ?? 0;
|
||||||
|
if (gapWithout >= 30 && gapWith < gapWithout) {
|
||||||
|
const firstGap = gapsWith[0] ?? 0;
|
||||||
|
const secondGap = gapsWith[1] ?? 0;
|
||||||
|
results.set(slotStartStr, {
|
||||||
|
isBlocked: false,
|
||||||
|
showWarning: true,
|
||||||
|
warningMessage: `This booking (${slotStartStr}–${slotEndStr}) would split your suggested lunch break into ${firstGap} and ${secondGap} minute blocks.`
|
||||||
|
});
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
results.set(slotStartStr, {
|
results.set(slotStartStr, {
|
||||||
isBlocked: true,
|
isBlocked: true,
|
||||||
showWarning: false,
|
showWarning: false,
|
||||||
@@ -221,11 +236,21 @@ export function getLunchProtectionForSlots(
|
|||||||
const gapsWithout = findAllLunchGaps(windowStart, windowEnd, existingBookings);
|
const gapsWithout = findAllLunchGaps(windowStart, windowEnd, existingBookings);
|
||||||
const gapWithout = gapsWithout[0] ?? 0;
|
const gapWithout = gapsWithout[0] ?? 0;
|
||||||
if (gapWith < gapWithout) {
|
if (gapWith < gapWithout) {
|
||||||
results.set(slotStartStr, {
|
if (gapsWith.length > 1) {
|
||||||
isBlocked: false,
|
const firstGap = gapsWith[0] ?? 0;
|
||||||
showWarning: true,
|
const secondGap = gapsWith[1] ?? 0;
|
||||||
warningMessage: `This booking would reduce lunch break to ${gapWith} minutes.`
|
results.set(slotStartStr, {
|
||||||
});
|
isBlocked: false,
|
||||||
|
showWarning: true,
|
||||||
|
warningMessage: `This booking (${slotStartStr}–${slotEndStr}) would split your suggested lunch break into ${firstGap} and ${secondGap} minute blocks.`
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
results.set(slotStartStr, {
|
||||||
|
isBlocked: false,
|
||||||
|
showWarning: true,
|
||||||
|
warningMessage: `This booking would reduce lunch break to ${gapWith} minutes.`
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user