# Optimizing in a booking app

**URL:** <https://community.glideapps.com/t/optimizing-in-a-booking-app/28785>\
**Category:** Ask for Help\
**Created:** [July 6, 2021, 3:14pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785 "2021-07-06T15:14:29Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 3:14pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/1 "2021-07-06T15:14:29Z")

</div>

**My use case:**  
A booking app where 100 people can do reservations of a table in two different buildings. The user is actually reserving a space for his team - not a specific table. It is restricted in the app that there cannot be done more than 68 reservations - equaling the number of tables in two buildings.

_Key info_  
100 people  
12 teams  
68 tables  
2 buildings - one with 30 table and one with 38 tables

Some people are working from home - as example team1 consists of 12 people but only 5 people will work on-site. So it is dynamic on each day how many people from each team that is onsite.

**The challenge:**  
Distribute the teams in the two buildings so no team is divided into two different buildings.

Do you think this can be done by Glide logic - or would you need to do some scripting in Google sheets to optimize the table allocations between teams.

Do you have suggestions how to go about getting the teams distributed. Thanks a lot 🙂

---

<div class="post-metadata">

**Author:** ![Roldy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/roldy/32/36068_2.png) [@Roldy](https://community.glideapps.com/u/Roldy)\
**Post date:** [July 6, 2021, 5:28pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/2 "2021-07-06T17:28:52Z")

</div>

Hi @Krivo If I understand correctly.  
If you have a row for each team that has booked in the building, if in that row you have the number of people who are on site for that team, then it becomes easy to know how many tables are left for that building.  
Consequently, before reserving one building or the other, you will check if there is a sufficient number of tables for that team to accommodate it in full.  
If this is the logic, I don’t think there are any problems implementing it completely in Glide. Or I missed something.  
It’s interesting! Let me know.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 8:25pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/3 "2021-07-06T20:25:18Z")

</div>

@Roldy Probably an import information missing. The employees can book a table until a certain time - maybe until the day before at 3 pm. Then the tables are assigned to the different teams. Team1 gets table 1-5, Table2 gets table 6-14 etc. So the number of tables that a team will need isn’t fixed until the the day before at 3pm because people for the different teams can book until then.

Does it make sense?

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 8:54pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/4 "2021-07-06T20:54:24Z")

</div>

**Example:**

Team1: 10 (Building 1) Total 10  
Team2: 10 (Building 1) Total 20  
Team3: 9 (Building 1) Total 29

Team4: 6 (Building 2) Total 6  
Team5: 6 (Building 2) Total 12  
Team6: 6 (Building 2) Total 18  
Team7: 6 (Building 2) Total 24  
Team8: 6 (Building 2) Total 30  
Team9: 5 (Building 2) Total 35  
Team10:4 (Building 2) Total 38 (+1 above limit)

So just filling up with the largest teams will not work. Ends up with 29 in building 1. A solution where no teams are splitted would be to put Team 4,5,6,7,8 in Building 1. But the challenge is to find out which teams should go were

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [July 6, 2021, 9:00pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/5 "2021-07-06T21:00:55Z")

</div>

Can every table seat the same number of people? Does it even matter?

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 9:06pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/6 "2021-07-06T21:06:41Z")

</div>

@Robert_Petitto one table seats one person. So the two buildings can seat 68 people as there are 68 tables.  
If there was just one building it would have been simpler - then just fill up from one end

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [July 6, 2021, 9:34pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/7 "2021-07-06T21:34:26Z")

</div>

Gotcha…should be doable tho. Tricky part is that you want the app to automatically assign them each day based on that dynamic “who’s remote?” number?

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 9:44pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/8 "2021-07-06T21:44:03Z")

</div>

@Robert_Petitto yes the tricky part is the assignment of tables to the teams on each day where the number of tables for each team is variable - and they must be placed in two different buildings. Appreciate any input

---

<div class="post-metadata">

**Author:** ![Robert\_Petitto](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/robert_petitto/32/25193_2.png) [@Robert\_Petitto](https://community.glideapps.com/u/Robert_Petitto)\
**Post date:** [July 6, 2021, 9:45pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/9 "2021-07-06T21:45:53Z")

</div>

What does the daily schedule look like? Is it ultimately just a raw number of people from each team that are going to be at a building that day?

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 6, 2021, 9:53pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/10 "2021-07-06T21:53:47Z")

</div>

@Robert_Petitto yes. Time slots per person is not in scope.  
Fit in 30 people in building 1 and 38 people in building 2. And keep the teams together.

There can be less than 68 people in total but that will just leave some spaces.

I restrict the number of people to book to maximum 68. First come first serve.

---

<div class="post-metadata">

**Author:** ![Roldy](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/roldy/32/36068_2.png) [@Roldy](https://community.glideapps.com/u/Roldy)\
**Post date:** [July 7, 2021, 7:00am UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/11 "2021-07-07T07:00:56Z")

</div>

Can there be the case in which a team, despite having booked later, may have found seats at the table simply for the fact that it is smaller than the one who booked before?

---

<div class="post-metadata">

**Author:** ![jchimp](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jchimp](https://community.glideapps.com/u/jchimp)\
**Post date:** [July 12, 2021, 9:44pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/12 "2021-07-12T21:44:45Z")

</div>

But isn’t it near impossible to never have the teams split? I mean at some point if the number of people on the team is larger than the number of tables available in that building, they will have to split.

---

<div class="post-metadata">

**Author:** ![jchimp](https://avatars.discourse-cdn.com/v4/letter/j/ecc23a/32.png) [@jchimp](https://community.glideapps.com/u/jchimp)\
**Post date:** [July 12, 2021, 9:46pm UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/13 "2021-07-12T21:46:16Z")

</div>

Why doesn’t each team have their own fixed table and have the tables between the two buildings organized as such? (sorry if that’s a stupid remark) just wondering.

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 13, 2021, 5:38am UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/14 "2021-07-13T05:38:12Z")

</div>

@jchimp thx for chipping in👍  
There is a risk that teams needs to split. But some teams might only show up with 2 or 3 people and that is easier to fill the holes with these

---

<div class="post-metadata">

**Author:** ![Krivo](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/krivo/32/5363_2.png) [@Krivo](https://community.glideapps.com/u/Krivo)\
**Post date:** [July 13, 2021, 5:40am UTC](https://community.glideapps.com/t/optimizing-in-a-booking-app/28785/15 "2021-07-13T05:40:37Z")

</div>

@jchimp thx again. The problem is that it is dynamic how many tables each team will need. Some days they will need 10 other days maybe 2 depending on who is on-site and who is off-site.
