# How availability is calculated

PiGi does not store a calendar of time slots. It generates the slots for a date on the fly from the activity's weekly template, then applies any availability exceptions you have created for that date, then subtracts the participants already booked. Closing a day means adding an exception, not deleting slots.

Source: https://help.pigi.io/guides/company-setup/activities/availability-and-slots

## Quick answers

**How does PiGi decide which time slots are available?**
It works them out fresh each time someone looks. Starting from the activity's operating days, hours
and slot duration, it cuts the day into slots, applies any availability exceptions
covering that date, then subtracts participants already booked. Nothing is stored
in advance, so changing the activity's hours changes every future day immediately.

**Why does a slot show as unavailable even though nobody has booked it?**
Most often the advance-booking lead time. A slot starting sooner than **Advance
Booking Hours** from now is marked *outside window* and cannot be booked, even when
it is empty.

**Why does my activity produce no slots at all on a date?**
Either the weekday is not in the activity's operating days, or the slot duration is
longer than the gap between the operating Start and End times, or a **Close**
exception covers the date.

**What do the slot statuses mean?**
**Available** — bookable. **Full** — booked participants have met the cap.
**Blocked** — a closure covers it. **Outside window** — it starts inside the
advance-booking lead time. Customers are only offered *available* slots; the admin
availability workspace shows all four.

**Does "Allow Same Day Booking" close today's slots when I turn it off?**
No. That switch is stored but never read. Only **Advance Booking Hours** controls
how close to a slot a customer may book.

## The four layers, in order

1. **The activity's weekly template.** The day-of-week gate first: if the date's
   weekday is not in the activity's operating days, the day is closed and produces
   no slots. An activity with **no** operating days selected has no gate at all and
   runs every day. If the day is open, slots are cut from **Start** to **End**, each
   one **Default Duration** long, stopping when a whole slot no longer fits. Each
   slot starts with capacity **Max Participants Per Slot**.

2. **Availability exceptions** — the entries created in Manage Availability, each
   covering a date range and optionally limited to certain weekdays:
   - **Reopen** and **Hours** reshape the day. Hours replaces the operating window
     for those dates; Reopen additionally forces open a day the weekly template
     would have closed.
   - **Close** marks slots blocked — the whole day, or only slots starting inside
     the From/To window when *Whole day* is off. The reason you type is carried onto
     the blocked slots. **Block day** and **Block slot** on the day view create the
     same kind of entry, so they appear alongside anything you made in Manage
     Availability.
   - **Capacity** replaces the per-slot maximum for the matched slots. Where two
     capacity entries overlap, the smaller wins.

3. **Per-slot capacity overrides.** A single stored slot row can raise capacity for
   one exact time — this is what a staff capacity override on an over-sized group
   booking writes. It is the most specific layer, so it beats a capacity exception.
   Raising capacity is all it does; blocking is never stored here, which is why a
   block and an unblock leave a bumped capacity untouched.

4. **Existing bookings.** Every booking for that activity on that date that is not
   cancelled or void has its participant count subtracted from the slot whose start
   time it matches. "That date" and "that start time" are read in **your school's
   local time**, so an evening or early-morning slot is counted on the day you
   would call it, not the day it happens to fall on in UTC.

## Timezone: everything is your school's local time

Slot labels, operating hours, exception windows and booking times all use the
timezone on your company profile (**Company details → Timezone**). A customer in
another country sees your 09:00 slot as 09:00; their own clock never decides which
slot they booked, so an overseas booking lands on exactly the slot they clicked.

Underneath, times are stored as universal instants and converted for display —
which is why changing your school's timezone re-labels existing bookings. The
moment did not move; the clock you read it on did. **Set it once, correctly.**

## Worked example

Operating Start 09:00, End 17:00, Default Duration 60 minutes, Max Participants Per
Slot 4, Advance Booking Hours 24.

- Eight slots are generated: 09:00 through 16:00, each 4 seats.
- A **Capacity** exception of 2 for that week drops every slot to 2 seats.
- A **Close** exception scoped 09:00–12:00 blocks the 09:00, 10:00 and 11:00 slots;
  12:00 onward stay available.
- A booking for 2 people at 14:00 makes the 14:00 slot *full*.
- Every slot starting within the next 24 hours reads *outside window*.

## What is not part of the calculation

These activity fields exist but do not affect which slots are produced:

- **Cutoff Booking Hours** — stored, never read.
- **Allow Same Day Booking** — stored, never read.
- **Participants Per Instructor** and **Total Instructors Available**.
- **Equipment Required** and **Equipment Per Participant**.
- **Weather Dependent** and **Min/Max Wind Speed** — these drive the
  flights-on-hold and stand-down flow, not slot generation.
- **Slot-based Availability** — slots are generated whether it is on or off. Only a
  course listing gets a different customer flow.

## Known limitations

- **Your company timezone must be set.** If it is unset, PiGi falls back to a
  default zone (South African time) — right for most schools, silently wrong for
  anyone else.
- **Overseas bookings taken before 2026-08-05 may sit on the wrong slot.** The
  wizard used to send the customer's *browser* clock instead of yours. These
  cannot be repaired automatically — the browser's timezone was never recorded —
  so confirm any disputed old booking with the customer. Bookings made from inside
  your own country were always saved correctly.
- **Unblocking one slot of a whole-day block reopens the whole day.** The block was
  recorded as one Close entry covering the day, and unblocking from the slot drawer
  removes that entry. To reopen a single date out of a longer closure, use
  **Unblock day** on the date itself.
- **Blocks made before 2026-08-05 never took effect.** Until then the day and slot
  block buttons saved a record the slot engine did not read, so the day stayed
  bookable. Those saved blocks have been converted into real Close entries, so days
  you thought were shut are shut now — check **Scheduled changes** for entries you
  no longer want, and check for bookings that were taken on days you had blocked.
- **The availability calendar shows at most 90 days** at a time.

## Related

- [Close dates and change capacity](manage-availability.md)
- [Set capacity and scheduling for an activity](activity-capacity-and-scheduling.md)
- [Booking settings and automation](booking-settings.md)
