diff --git a/README.md b/README.md
index e14caf8..fe5f6b1 100644
--- a/README.md
+++ b/README.md
@@ -139,7 +139,7 @@ All routes in `app-admin` except `/login` are guarded in `src/hooks.server.ts`.
- `/pages/[slug]` — block editor with draft preview. Text is edited visually (headings, bold, italic, strikethrough, links, lists, pull quotes, lines; alignment and a small *footnote* size per block). Layouts have their own blocks: **Cards** (pictures or numbered steps, optionally linked — e.g. *Who I work with*, *Read next*, *How it works*) and **FAQ** (questions that open to show the answer). An **HTML** block takes raw HTML for embeds and one-offs (inline styles only; anything it loads from another site shares visitors' IPs). Every block has an *Anchor*, so a button or link to `#prices` jumps to it.
- `/calendar` — events shown by Upcoming Calendar blocks
- `/items` — services, products and bundles shown in Shop blocks
-- `/slots` — when the practitioner can be booked: **windows** (e.g. 09:00–12:00, with the services bookable in it and where bookings may start — in fixed steps (every 10–60 min, default 30), or only at the start/end of the free time) and **group sessions** (one service at one of its lengths, fixed time, places). Month calendar, a day view with free time and bookings, and bulk tools — *Generate slots* (date range × weekdays × hours → windows, or sessions spaced by length + get-ready time), *Copy a week* (repeat into the next 1–12 weeks) and *Clear slots* (slots with nothing booked). Windows may not overlap each other, nor sessions of the same service; bulk tools preview first and skip past or overlapping slots. A window can't shrink past a booking in it.
+- `/slots` — when the practitioner can be booked: **windows** (e.g. 09:00–12:00, with the services bookable in it and where bookings may start — in fixed steps (every 10–60 min, default 30), or only at the start/end of the free time) and **group sessions** (one service at one of its lengths, fixed time, places). Month calendar, a day view with free time and bookings, and bulk tools — *Generate slots* (date range × weekdays × hours → windows, or sessions spaced by length + get-ready time), *Copy a week* (repeat into the next 1–12 weeks) and *Clear slots* (slots with nothing booked). No two slots may overlap (windows and group sessions alike); bulk tools preview first and skip past or overlapping slots. A window can't shrink past a booking in it.
- `/items` lists each service's lengths and prices (*Lengths and prices* rows); the Shop block shows a slider between them.
- `/passes` — *Vouchers & codes*: search codes (code, email, recipient, bundle), see what each has used/held/left and each part's share of the price, change the expiry, void/reactivate, and issue a code without a purchase
- `/orders` — confirmed bookings and purchases, with booking-email status and resend buttons
diff --git a/app-admin/src/lib/admin/slots/BulkActions.svelte b/app-admin/src/lib/admin/slots/BulkActions.svelte
index 1345df1..07d718b 100644
--- a/app-admin/src/lib/admin/slots/BulkActions.svelte
+++ b/app-admin/src/lib/admin/slots/BulkActions.svelte
@@ -26,7 +26,7 @@
Nothing to {deleting ? 'delete' : 'create'}.
{/if}
- {#if preview.skippedOverlap}- {plural(preview.skippedOverlap, 'slot')} skipped — it would overlap another window, or a session of the same service.
{/if}
+ {#if preview.skippedOverlap}- {plural(preview.skippedOverlap, 'slot')} skipped — it would overlap another slot.
{/if}
{#if preview.skippedPast}- {plural(preview.skippedPast, 'slot')} skipped — in the past.
{/if}
{#if preview.kept}- {plural(preview.kept, 'slot')} kept — something in it is booked, or in a customer’s basket right now.
{/if}
diff --git a/app-admin/src/routes/slots/+page.server.ts b/app-admin/src/routes/slots/+page.server.ts
index 6195fe8..f57c15f 100644
--- a/app-admin/src/routes/slots/+page.server.ts
+++ b/app-admin/src/routes/slots/+page.server.ts
@@ -123,26 +123,19 @@ function sessionFields(data: FormData, services: Service[]): SlotFields | { erro
}
/**
- * Slots that may not overlap: windows with any other window (one
- * practitioner, one opening time), a group session with another session of
- * the same service. A session may overlap a window — whichever is booked
- * first blocks the other (see the README's Slot availability).
+ * A slot that `fields` would overlap (ignoring `exceptId`), or null — or undefined if PocketBase can't be read.
+ * No two slots may overlap, whatever their kind or service: one practitioner works them all.
*/
-function clashKey(slot: Pick) {
- return slot.kind === 'window' ? 'window' : `session:${slot.items[0] ?? ''}`;
-}
-
-/** A slot that `fields` would overlap (ignoring `exceptId`), or null — or undefined if PocketBase can't be read. */
async function clashingSlot(pb: Pb, fields: SlotFields, exceptId = '') {
const key = toZonedDatetimeInput(fields.start, siteTimezone()).slice(0, 10);
const existing = await slotsForDays(pb, addDaysToKey(key, -1), addDaysToKey(key, 1));
if (!existing) return undefined;
- return existing.slots.find((slot) => slot.id !== exceptId && clashKey(slot) === clashKey(fields) && overlapsAny(fields, [slot])) ?? null;
+ return existing.slots.find((slot) => slot.id !== exceptId && overlapsAny(fields, [slot])) ?? null;
}
function clashMessage(slot: SlotDetail) {
const time = `${toZonedDatetimeInput(slot.start, siteTimezone()).replace('T', ' ')}–${toZonedDatetimeInput(slot.end, siteTimezone()).slice(11)}`;
- return slot.kind === 'window' ? `This overlaps the window ${time}. Change that one instead.` : `This overlaps another ${slot.itemNames[0] ?? ''} session (${time}).`;
+ return slot.kind === 'window' ? `This overlaps the window ${time}. Change or delete that one first.` : `This overlaps the ${slot.itemNames[0] ?? ''} group session ${time}. Change or delete that one first.`;
}
/** Validated `from`/`to` date keys from a bulk form, or an error message. */
@@ -164,13 +157,12 @@ function slotsForDays(pb: Pb, fromKey: string, toKey: string, item = '') {
}
/**
- * Drop candidates that start in the past or overlap a slot they may not
- * overlap (existing, or accepted earlier in this run — see clashKey).
+ * Drop candidates that start in the past or overlap another slot (existing,
+ * or accepted earlier in this run — see clashingSlot).
*/
function filterCandidates(candidates: SlotFields[], existing: SlotDetail[]) {
const now = Date.now();
- const taken = new Map();
- for (const slot of existing) taken.set(clashKey(slot), [...(taken.get(clashKey(slot)) ?? []), slot]);
+ const taken: PlannedSlot[] = [...existing];
const accepted: SlotFields[] = [];
let skippedPast = 0;
@@ -180,13 +172,11 @@ function filterCandidates(candidates: SlotFields[], existing: SlotDetail[]) {
skippedPast++;
continue;
}
- const ranges = taken.get(clashKey(candidate)) ?? [];
- if (overlapsAny(candidate, ranges)) {
+ if (overlapsAny(candidate, taken)) {
skippedOverlap++;
continue;
}
- ranges.push(candidate);
- taken.set(clashKey(candidate), ranges);
+ taken.push(candidate);
accepted.push(candidate);
}
accepted.sort((a, b) => instantMs(a.start) - instantMs(b.start));