Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block restaurant dish edit if there are open enrollments that use that restaurant #861

Open
Kurocon opened this issue May 20, 2024 · 0 comments
Labels
back-end These are issues related to our Django back-end bug Undesired and unintended behaviour in the website

Comments

@Kurocon
Copy link
Member

Kurocon commented May 20, 2024

Recently, the dishes for Oh My Grill were edited, where all old dishes were removed, and new ones were added.
There were also still a few activities with open enrollments, that used Oh My Grill as a restaurant.
This created a situation where those old enrollments could not select any dish for the food option.
Also, any enrollments that already had participants with selected food options, would generate a 500 error because the dish prices could not be retrieved.

When we create a food enrollment option, we create a copy of the current prices of the dishes (DishPrice), so that existing enrollments keep the old price. So, on the activity enrollment, only the dishes and prices that existed when the enrollment was created are shown. However, if the enrollment is still open, and all of the dishes that existed when it was created were made unavailable, then no dishes are now shown due to the model filter and enrollment becomes impossible!

The easiest way to prevent this is to prevent editing a restaurant's dishes if there are any open enrollments that use that restaurant.

This may be a bit overkill though (because now to edit the restaurant you need to wait for those enrollments to close, or remove the option), maybe an alternative option exists? Open for suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
back-end These are issues related to our Django back-end bug Undesired and unintended behaviour in the website
Projects
Status: Ready
Development

No branches or pull requests

1 participant