Search lands in PR-5.1 (Pagefind).

How-to Intermediate

Chapter 1 Updated

My Calendar I

Overlap test per booking: start < existing_end AND end > existing_start.

  • Full 5m
  • Revision 2m
  • Flow 1m

My Calendar I — control flow

flowchart TD
    S["<b>i · book(start, end)</b>"]
      --> L{"<b>ii · next existing [s, e]?</b>"}
    L -->|"yes"| C{"<b>iii · overlap?</b><br/>start &lt; e and end &gt; s?"}
    C -->|"yes"| F["<b>iv · return false</b>"]
    C -->|"no"| L
    L -->|"done"| A["<b>v · append (start, end)</b>"]
      --> T["<b>vi · return true</b>"]
 
    classDef start fill:#f5efe1,stroke:#6a8a4f,stroke-width:2px,color:#1a1915;
    classDef decision fill:#fdecd3,stroke:#c2410c,stroke-width:2px,color:#1a1915;
    classDef ok fill:#e7efd9,stroke:#587640,stroke-width:2px,color:#1a1915;
    classDef bad fill:#f5d4cf,stroke:#991b1b,stroke-width:2px,color:#1a1915;
    class S start
    class L,C decision
    class A,T ok
    class F bad
  • Entry

    New booking arrives as `(start, end)` — half-open interval.

  • Iterate

    Walk existing bookings one at a time.

  • Overlap test

    `start < e and end > s` — strict because `[start, end)` is half-open.

  • Reject

    First overlap ends the scan; return `false` without mutating state.

  • Accept

    No overlaps found — append `(start, end)` to the bookings list.

  • Return

    Signal success with `true`.

Comments

Comments are disabled in this environment. Set PUBLIC_GISCUS_REPO, PUBLIC_GISCUS_REPO_ID, and PUBLIC_GISCUS_CATEGORY_ID to enable.