Hi all, not sure if anyone has thought about this before or even implemented before - a waitlist feature for classes.
For eg. a yoga class at a studio that has a maximum capacity of 10 students. Once 10 users have booked the class, enable an “add to waitlist” function, which adds any subsequent users to a waitlist. Each user in the waitlist would have a “queue number”. ie. First user that joins the waitlist will be #1, second user #2, third user #3 and so on. When a student enrolled in the class cancels, the user who is #1 on the waitlist will be added to the class automatically. Also, #2 and #3 will move up the waitlist, becoming #1 and #2 on the waitlist respectively.
Although it sounds like a very simple feature, I’m confused on how to set up the logic and actions. I imagine I’ll need to create another collection called “waitlist” that has a 1-to-1 relationship with the classes, and a many-to-many relationship between the users (ie. 1 user can waitlist for multiple classes, and each waitlist can have multiple users).
The biggest question is… How do I set up the actions (I’m open to creating custom actions that uses Adalo’s API to execute multiple changes at one go) to move users up the waitlist and add them into the class in sequence?
I can set up an action that executes when a user enrolled in a class cancels - when user cancels class, remove user from the class and add a user from the waitlist to the class. But how to make sure that action adds the user who is #1 on the waitlist?
The other problem is when there are more than 2 users in the waitlist. For eg. 5 waitlisted users, and #3 in the waitlist remvoes herself. How to make sure ONLY #4 and #5 moves up the waitlist while #1 and #2 stays put? I could add “waitlist queue numbers” to each user, but as far as I know, you can only change 1 record per action.
EDIT: I thought about sorting by timestamp, which is a reliable way to decide each user’s queue number in the waitlist. The question is: how to sort the collection records by timestamp + choose to edit the earliest record that was added to the collection?
I’m open to paying anyone with any ideas of how to implement this as it’d be a very important feature when our physical studio opens in May (yay!). We’ve been only running online classes, and a waitlist was never an issue since online classes are not restricted to physical capacity.
Thank you in advance for any ideas/help!