Optimizing in a booking app

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 :slight_smile:


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.


@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?


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

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

1 Like

@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

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?

1 Like

@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

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?

@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.

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?

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.

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.

@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

@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.