# Complex Bookings Setups

## What is complexity?

A complex booking setup is any configuration of a service's availability that requires the plugin to do a significant amount of processing.

When a service (an EDD Download) is saved, the plugin needs to go through all of the availability rules configured in the calendar to determine all of the possible booking times, which takes time. For simple availabilities, this can take a fraction of a second. For other availabilities, this might take multiple seconds. The determining factors are:

- the number of different session lengths - due to increasing combinations
- the number of sessions that fit in a single range - like 15 minute sessions in a 12 hour day, versus 1 hour sessions in a 5 hour day
- the number of repetitions per range

As a general rule of thumb, the more available times your service can have, the more complex your setup is. The potential complexity is the reason why the availability rules are required to stop repeating at some point, and can't repeat forever. That being said, automatic re-generation might be an upcoming feature.

We consider a normal setup to have between 1 and 3 possible session lengths, having between 10 to 30 available bookable times per day, 20 - 30 days a month, for a whole year. Any setup that has more possible bookable times than that is considered to be approaching complexity.

A good example of a very complex setup would be having 4 or more possible session lengths, around 300 different possible bookable times per day for the different possible durations, for every day of the month and for every month in a year. This creates over a hundred thousand possible available booking times in a single year.

## Determining Complexity

With some simple mental math, you can determine how complex your service's availability is.

First, start by determining how many sessions fit within a single available range. Let's say you accept 1 hour and 2 hour sessions, and you have your availability set up between 8am and 4pm that repeats on all working days for a whole year. Between 8am and 4pm, there are 8 hours. That means that you can fit 8 sessions that are 1 hour long, 4 sessions that are 2 hours long, or any combination of both (for instance, three 1-hour sessions followed by two 2-hour sessions and another 1-hour session).

Next, take your results and multiply them together, removing any decimal parts from your previous results before multiplying.- Our results were 8 sessions (for 1-hour durations) and 4 sessions (for 2-hour durations). Our next result is 32. Now take this result and multiply it by the number of times the time range repeats. Ours repeats on every work day for a whole year. In other words, we multiply by 5 for every work day and then multiply by 52, which is the most common number of weeks that a year has. The end result is 8,320. This is the **score** of this time range.

- 8 x 4 = 32 possible bookings in a day

- 32 x 5 days = 160 possible bookings in a week

- 160 x 52 weeks = 8,320 possible bookings in a year

Repeat the above for all the time ranges and add up the scores to get the total score of your service's full availability. The higher this number is, the more complex your setup.

For reference, the normal availability previously mentioned would have a score of around **56,160**. We typically consider any score below **100,000** to be relatively simple.So a score of 8,320 should tell you that you have a very simple availability set up for your service.