I am trying to generate a weekly menu populated by items picked at random from a list of dishes. My Dishes table in the database contains the following fields:
- Dish name (text: contains the name of the dish)
- Dish Tag (list: contains tags like “Breakfast”, “Dinner”, “Lunch”)
- Dish Accompaniments (list: contains names of accompaniments like “bread”, “rice”, etc)
- Dish Category (list: contains text like “low-fat”, “heavy”, etc)
What I want to do now is create a UI which shows me all the days of the week, with three slots for each day: Breakfast, Lunch, Dinner. When I press a “Generate” button I want the app to fill in dishes in the appropriate categories. In the breakfast slot of each day, I want a dish randomly picked up with the “Breakfast” tag, and the name of the dish to be printed on the slot for that day. Same thing for the next day. I also want this to be unique as far as possible, meaning if the dish is used in a previous day, it should not be repeated unless all the dishes marked as “breakfast” are used up.
Additionally, if the Accompaniments field is not empty, whatever is in that field should appear along with the name of the dish. I’ve been struggling with getting this to work. The data is all in place and I managed to do a form that lets users add dishes. What I can’t seem to manage is pulling the data out of the database!
For special hard-mode points, I’d also like to be able to define categories. So before the user hits Generate, they can toggle on or off specific things like “low-fat” or “heavy” and the system first uses all items with those categories and then uses other categories.
What would be even more amazing is to then let the user edit any of the Breakfast, Lunch or Dinner cells on any of the days of the week, swapping out system-generated items with others in the database, then finally saving the week’s menu.