Sure! It boils down to wanting to be able to have users purchase and use consumables of some kind. To-go meal credits in my case (like MealPal), but would be useful for things like personal training sessions as well.
I think my dream solution with Glide would be to have credits or virtual currency be a special kind of thing that gets managed by the Glide system. Like having an “App:Credits” sheet that lists one or more types of currency for each app user. A Stripe purchase and maybe other actions could add X amount to currency Y for the current user. Components could be shown or hidden based on currency thresholds. And form submissions could automatically deduct X amount from a given currency.
That said, here are the particulars of what I was using Apps Script for:
I wanted to give users 1 credit when they signed up, for testing. There seems to be no way to submit a new user form and supply an implicit default value. I tried setting up Single Value and Template columns and sending those as implicit column values, but those seem to not work correctly until after the user row is set up. So one of my script actions is to look for new user rows and fill them in with some default values. Just having a hidden default value component would solve that.
When the user submits a form to order the meal of the day it adds a new row to an Orders sheet. I need to:
- Mark the user as having ordered for the day.
- Subtract 1 credit from the user’s balance.
- Make sure the order isn’t a duplicate since it takes a while for the above two changes to propagate back to the app and the user could submit the form a second time.
Here are some other things I was planning to do.
- I would have a per-user admin flag that allows the chef to manage upcoming meals (easily done) and see how many orders were placed for the meal-of-the-day (easy using a formula).
- Admin mode would also allow a server to see a list of all the orders and check off the ones that have been picked up (easy I think).
- I would have a “cron” script that goes through once a day and resets the “order placed” flags so the user can order again the next day and it would copy the info for the next available meal to a “current meal” slot. It would probably also move all of the day’s orders to a permanent log on a separate sheet. This one is custom enough to where sticking with a script is probably appropriate.